more info from sys-info

Started by nigelbrown, January 02, 2004, 03:16:52 PM

Previous topic - Next topic

nigelbrown

I've reposted this as a new thread:

Hi Lutz

Thank you for adding the -m N memory limiting switch to 7.4.1 in the development stream.

I've tried it with

(define (usemem n)(dotimes (x n) (set (symbol (string "nnn" x)) (sequence 1 1000))))

and newlisp stops very gracefully.



Could you make the memory restriction limit available via (sys-info) so that a program could potentially take action if the memory limit was approaching or so it could check prior to a memory intensive action?

(I realise that newlisp can't say that the memory will actually be available from the system)



Nigel

Lutz

#1
I have read your earlier post and added max cells (derived as 65k times N in -m N) as the second parameter in 'sys-info'. This has prompted changes in httpd, stat.lsp and init.lsp from the distribution, which inquire the OS platform or newLISP version Nr.



In 7.4.4 (posted on the coming weekend) everybody should check if affected by this change in 'sys-info' and another change in 'now' and 'date':



'now' has an addtional value in the returned list, which is the timezone offset: 'minutes west of GMT', 'minutes' seems to be the standrad for spcifying timezone offsets, which prompted the following change:



Both, 'now' and 'date' will take the optional offset parameter now in minutes (formerly hours).



Also, the weekend development release 7.4.4 will document the new changes in a 7.4.4 manual. This means that the online manual 7.4.0-rev-6 will not be updated anymore until the 7.5 release (end of January).



All manual changes than will be only refleected in development versions. If anybody has something urgent, which should be in the online 7.4.0 manual, I would need that before Sunday for a final 7.4.0-rev-7.



Lutz

nigelbrown

#2
Thanks Lutz,

Why not just tack the new parameter on the end of the sys-info returned list - then nothing would be broken by the change? Along as everybody knows where they are I wouldn't be too concerned about keeping the memory stuff close together.

Nigel

HPW

#3
Or make an assoc list of it. Then the position is no more relevant.

And it would be more self-explaining.



(list (list "version" 7404) .......)
Hans-Peter

nigelbrown

#4
An assoc list sounds a good way to go for a lisp system

Nigel

Lutz

#5
It really belongs together with the cell count in the first position. I try to have related numbers grouped in 'sys-info', so their position is easier to remember.  



For usage the idea of having an association list, is probably the best, but it would also make much more code for the 'C' function underlying 'sys-info' and affect it's performance.



It's always a pain to break compatibilaty with older versions, but one of the continuing design goals in newLISP is, to stay 'new' and current with needs of those who use it. When you compromise to much on that, the language gets stale and outdated. So functions come and go, change their faces ...



I will try to leave the platform always as last and the version as the second to last, so the platform is always (last (sys-info)) and the version (nth -2 (sys-info)).



Lutz

nigelbrown

#6
points taken Lutz, perhaps a few system constants MEMUSE MEMLIM etc so that

(nth MEMUSE (sys-info)) and (nth MEMLIM (sys-info)) would always give the info?



Nigel

Lutz

#7
yes, one could define those and stick them in the init.lsp file



Lutz

nigelbrown

#8
Or define a function to put them into an assoc list :).



As a general comment lisp has a tradition of having a lot of stuff implemented in lisp itself - compiling a selection of init-useful functions that people could refer to and use as they saw fit would give the option for and extended language or a lean language.

Perhaps a future manual appendix could have a selection of utility functions.



Nigel