Memory question

Started by newdep, January 18, 2007, 07:54:20 AM

Previous topic - Next topic

newdep

Hi Lutz,



perhaps you can clear me up ;-)



(391 268435456 342 1 0 2048 9016 7)

> (/ (sys-info 1) 65535)

4096





That means that the current loaded newlisp can handle 4096 Megabytes of data?





Question:



* How do I check during runtime the available amount of memory free for newlisp

inside my newlisp application? (I want to do  a dynamic check on the working

memory i have in newlisp)



Norman.
-- (define? (Cornflakes))

Lutz

#1
Quotehat means that the current loaded newlisp can handle 4096 Megabytes of data?


yes that is the maximim theoretical amount of data which can be handled by a 32-bit application.


QuoteHow do I check during runtime the available amount of memory free for newlisp inside my newlisp application?


A Unix system will use virtual memory and swap, so there is no way to find out, except for running 'top' or similar tools, which will tell you the amount of memory swapped, etc. Even if no free RAM is available for newLISP at a given moment, a memory manager might swap out other apps to make RAM available.



The comand line -m switch in newLISP can limit the total amount used.



Lutz

pjot

#2
Norman has discovered a peculiarity in Tru64Unix.


Quote
olga> newlisp -m 2

newLISP v.9.0.16 on Tru64Unix, execute 'newlisp -h' for more info.



> (sys-info)

(349 65536 343 1 0 2048 9016 9)

>

>

> (exit)


In Linux, the result is not '65535' but '131072'.



Is this behaviour correct for 64bit platforms?



Peter

Lutz

#3
QuoteIs this behaviour correct for 64bit platforms?


Yes, function pointers are 64-bit when compiled as a 64-bit application, only half the cells fit into the 2MB memory specified by '-m 2'.



Lutz



ps: at the moment when no -m option is used, the max-cells number is not correctly reported in 'sys-info'. This is fixed in 9.0.17.