newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Dmi on August 03, 2005, 04:26:07 PM

Title: memory allocation
Post by: Dmi on August 03, 2005, 04:26:07 PM
I got a list about 6000 complex elements into memory
(set 'd (read-db "filename"))
and got 15M of memory allocated by newlisp.

then I transform "d" as follows:
(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?
Title:
Post by: Lutz on August 04, 2005, 05:08:30 AM
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
Title:
Post by: Dmi on August 04, 2005, 06:27:32 AM
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)
Title:
Post by: Lutz on August 04, 2005, 08:42:33 AM
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