GSoC/GCI Archive
Google Code-in 2010 Haiku

Fix default swap file size when Virtual Memory is enabled

completed by: Hamish Morrison

mentors: Philippe Houdoin, Bruno Albuquerque, Jérôme Duval, yourpalal

https://dev.haiku-os.org/ticket/1746

From the Haiku Trac Ticket #1746 comments, we see this reported:

--------

When you open the VirtualMemory application for the first time and only check the 'Enable Virtual Memory'-box (do not move the slider), the application will create (on close) a 'virtual_memory'-file with the following contents:

vm on
swap_size 0

The next time you open VirtualMemory, it will interpret this as Virtual Memory disabled.

--------

If you check in /boot/home/config/settings/kernel/drivers/ you will find a virtual_memory file, this is a normal text file, the problem here seems to be that if the virtual memory size slider in the virtual memory preferences app isn't moved prior to closing the pref app, the virtual_memory file is left with a swap_size of 0.  It "should" default to the minimum swap file size.  What you need to do is to track down the cause of this bug and fix it.  The source code to the virtual_memory prefs app is in:

trunk/src/preferences/virtualmemory/

Be sure to compile and throughly test your fix, try deleting the virtual_memory file, then rerun the patched pref app and verify that it never puts a swap_size of 0 when vm is on.  When you are satisfied with your fix post a patch here.

If you need help getting Haiku running or compiling, you can usually find help in #haiku on IRC freenode.