Memory question

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Memory question

Post by 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

hat 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.
How 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
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post by pjot »

Norman has discovered a peculiarity in Tru64Unix.
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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Is 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.

Locked