Tuesday, July 22, 2014

libwebviewchromium.so is a memory hog Android 4.4.4_r1 inside Ubuntu 13 VM

A very good alternative is to install openbox which takes about 1/2 memory to load instead of standard ubuntu Windows Manager http://openbox.org/

target SharedLib: libwebviewchromium (out/target/product/hammerhead/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so)
collect2: error: ld terminated with signal 9 [Killed]
make: *** [out/target/product/hammerhead/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so]

When building inside a VM with Ubuntu VM in case you only created a swap partition of 2 GB, you need to add more swap because you need about 3GB of swap to link this monster libwebviewchromium...

1. Create empty file:
This file will contain virtual memory contents so make file big enough for your needs. This one will create 1Gb file which means +1Gb swap space for your system:
dd if=/dev/zero of=/var/swapfile.img bs=1024 count=3M
If you want to make 3Gb file then change count value to count=3M. See man dd for more information.
2. Bake swap file:
Following command is going to make "swap filesystem" inside your fresh swap file.
mkswap /var/swapfile.img
3. Bring up on boot:
To make sure that your new swap space is activated while booting up computer you should add it to filesystem configuration file 
/etc/fstab. Add it to end of file, this is recommended because other filesystems (at least one that contains swap file) must be mounted in read-write mode before we can access any files.
# Add this line to /etc/fstab
/var/swapfile.img swap swap sw 0 0

or

echo /var/swapfile.img none swap defaults 0 0 | sudo tee -a /etc/fstab


4. Activate:
You can either reboot your computer or activate new swap file by hand with following command:
swapon /var/swapfile.img

 If swapon fail please use sudo gparted and try to turn all swap partition off then on again 

If everything goes well
you should see that more swap space is available for use. You can use following commands to check your new swap and confirm that it is active:
cat /proc/swaps  
Filename                   Type       Size    Used    Priority
  /dev/sda5                partition  2094076 2094056 -1  
  /var/swapfile.img        file       4194300 383604  -2

grep 'Swap' /proc/meminfo
  SwapCached:        380992 kB
  SwapTotal:        6288376 kB
  SwapFree:         3838044 kB

No comments: