9th Apr, 2013, 08:06 AM
THIS IS DEPRICATED, DO NOT TRY IT.
This will no longer have a beneficial effect with future changes to memory handling and swap space in the next version. I recommend reversing the changes if you made them.
---------------------
Having a recent Rev.B I've modified my xbian set up to make a bit better use of the memory available.
First, I've mounted /tmp as a tmpfs. The defaults are fine because half of hardware memory as the top limit appears okay for the intended use. (Deliberately leaving /var/tmp alone as that may have large files written to it.)
Add the following line to /etc/fstab
Stopping XBMC, I symlink ~/.xbmc/temp to /tmp/, ~/.xbmc/userdata/addon_data/cache and ~/.xbmc/userdata/addon_data/script.common.plugin.cache to /tmp/, then reboot.
sudo /etc/init.d/xbmc stop
rm /home/xbian/.xbmc/temp
ln -s /tmp /home/xbian/.xbmc/temp
rm /home/xbian/.xbmc/userdata/addon_data/cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/cache
rm /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache
Then create cron.daily script that reaps old files from /tmp/ to try and prevent overflow on a device that is rarely rebooted.
Remember to run chmod a+r on the file so it will run every day. Then reboot.
Benefit: Noticeable responsiveness improvements in addons that create and process temporary files. Particularly ones that process downloaded rss/xml files, or download subtitle files.
Drawbacks: Caches cleared on reboot. But reboots are hopefully uncommon for XBian.
If anything fills /tmp/ with data over ~190mb, it's going to fail. I've yet to see this happen, and I don't know of any xbmc addon that would do this. If you know of a addon that uses creates temporary files over ~190mb, you might want to ask the addon's creator to store these files in a cache in it's addon_data directory. .xbmc/temp/ and common_cache appear to be intended for small temporary files only. tmpfs can be expanded beyond free memory, because it uses swap, but it can never be set above total hardware memory due to memory allocation handling.
There is the minor possibility that this could cause an issue due to file name collisions with something else. I haven't seen this happen on xbian, but it might be worth making a init script that properly creates a unique directory name in /tmp/ and creates the symlinks on boot.
This will no longer have a beneficial effect with future changes to memory handling and swap space in the next version. I recommend reversing the changes if you made them.
---------------------
Having a recent Rev.B I've modified my xbian set up to make a bit better use of the memory available.
First, I've mounted /tmp as a tmpfs. The defaults are fine because half of hardware memory as the top limit appears okay for the intended use. (Deliberately leaving /var/tmp alone as that may have large files written to it.)
Add the following line to /etc/fstab
Code:
tmpfs /tmp tmpfs nodev,nosuid 0 0
Stopping XBMC, I symlink ~/.xbmc/temp to /tmp/, ~/.xbmc/userdata/addon_data/cache and ~/.xbmc/userdata/addon_data/script.common.plugin.cache to /tmp/, then reboot.
Terminal
sudo /etc/init.d/xbmc stop
rm /home/xbian/.xbmc/temp
ln -s /tmp /home/xbian/.xbmc/temp
rm /home/xbian/.xbmc/userdata/addon_data/cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/cache
rm /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache
ln -s /tmp /home/xbian/.xbmc/userdata/addon_data/script.common.plugin.cache
Then create cron.daily script that reaps old files from /tmp/ to try and prevent overflow on a device that is rarely rebooted.
Code:
#!/bin/sh
#/etc/cron.daily/reaptmp
find /tmp/ -type f -mtime +3 -exec rm {} \;
Remember to run chmod a+r on the file so it will run every day. Then reboot.
Benefit: Noticeable responsiveness improvements in addons that create and process temporary files. Particularly ones that process downloaded rss/xml files, or download subtitle files.
Drawbacks: Caches cleared on reboot. But reboots are hopefully uncommon for XBian.
If anything fills /tmp/ with data over ~190mb, it's going to fail. I've yet to see this happen, and I don't know of any xbmc addon that would do this. If you know of a addon that uses creates temporary files over ~190mb, you might want to ask the addon's creator to store these files in a cache in it's addon_data directory. .xbmc/temp/ and common_cache appear to be intended for small temporary files only. tmpfs can be expanded beyond free memory, because it uses swap, but it can never be set above total hardware memory due to memory allocation handling.
There is the minor possibility that this could cause an issue due to file name collisions with something else. I haven't seen this happen on xbian, but it might be worth making a init script that properly creates a unique directory name in /tmp/ and creates the symlinks on boot.