Page 1 of 1

memory allocation

Posted: Wed Aug 03, 2005 11:26 pm
by Dmi
I got a list about 6000 complex elements into memory

Code: Select all

(set 'd (read-db "filename"))
and got 15M of memory allocated by newlisp.
then I transform "d" as follows:

Code: Select all

(set 'd (convert-db d))
Finally I got about 2000 transformed (and reduced) items in d,
but newlisp allocates 30M now!
All code and executing was done in separate context. I save this context to be sure, that no lost symbols are there.
As I can see, following subsequent caslls to mentioned (convert-db) does not cause newlisp size growing - so allocated space is reused properly.

But can newlisp dynamically reduce the size it allocated? And when?

Posted: Thu Aug 04, 2005 12:08 pm
by Lutz
It depends very much on the behaviour of the underlying OS. Sometimes newLISP gives memory back to the OS, but you will not see it in Window's taskmanager, then suddenly when another application needs more memory, the OS takes it. There is also some memory newLISP keeps in a 'free cell list' and reuses itself.

Lutz

Posted: Thu Aug 04, 2005 1:27 pm
by Dmi
Thanx!
What about Unix/Linux?
So, if I want to write a long-running daemon, that _sometimes_ gives much memory for processing - what will be it's "usual" memory usage? (possible resident and overall)

Posted: Thu Aug 04, 2005 3:42 pm
by Lutz
This is hard to asses, it all depends on the mix of applications running. Linux/Unix seem to be more aggressive in paging out memory taken by an application but unused. At a client's site (kozoru.com) newLISP runs as inetd demons on about a 100 machines and without any memory leaks.

Lutz