swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] Circumventing memory leaks via swap space


From: Marcus G. Daniels
Subject: Re: [Swarm-Support] Circumventing memory leaks via swap space
Date: Tue, 25 Nov 2008 19:42:29 -0700
User-agent: Thunderbird 2.0.0.17 (X11/20081009)

Steve Railsback wrote:
I got around the problem simply by creating a new giant swap partition on my Linux hard drive.

Another way to punt on memory leaks is to link against a conservative collector like http://www.hpl.hp.com/personal/Hans_Boehm/gc/


> Now, as the hours go by, the operating system
just periodically dumps another truckload of garbage out of RAM and into the swap partition. The processor (core 2 duo) does not even slow down noticeably as RAM fills up.

To do that on Linux:

1. Make a large file with "dd if=/dev/zero of=swapfile bs=1024
count=BIGNUMBER".  Where BIGNUMBER is the number of kilobytes in your
swapfile.
2) Set it up as a swapfile with "mkswap swapfile".
3) Bring it online  "swapon swapfile".

On a 64 bit machine, it will work fine provided the garbage memory represents unreferenced or inactive objects. It won't work fine with a 32 bit machine as you'll run out of virtual address space soon enough. It won't have good performance if there are objects intertwined and chasing through the pointers means swapping in memory.

Incidentally, one of the possible applications of the Zone concept is to
have Zones mapped to files.   A system swapfile is just one kind of
memory mapped file.  In that way the whole state of a
simulation could be preserved using this low-level mechanism.

Marcus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]