[erlang-questions] mnesia memory isn't freed after search ?

Richard Andrews <>
Mon May 25 00:42:13 CEST 2009


> I'm doing some tests with Mnesia, trying to load a milion records and
> read them, but apparently memory isn't freed after I do a search. After
> ...

Might be related to garbage collector behaviour. Memory isn't always reclaimed straight away but rather hangs around for some (large) nunmber of generations before being reclaimed. This is why lots of small searches is more reliable: the amount of data per generation is smaller, but the number of generations is constant.

You can tweak garbage collection behaviour via erlang:spawn_opt (also in gen_server options etc). In particular have a look at the fullsweep_after option.

You can use appmon or other debugging tools to find which processes have a large heap. Manual garbage collection can be triggered with erlang:garbage_collect(Pid). If this frees up the memory then tweaking GC behaviour should solve your problem.

--
  Rich


      Need a Holiday? Win a $10,000 Holiday of your choice. Enter now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline



More information about the erlang-questions mailing list