Not Enough Memory trap - is it normal behaviour?

Q&A's, tips, howto's
Locked
IVShilov
Posts: 23
Joined: Wed Apr 12, 2017 1:58 am

Not Enough Memory trap - is it normal behaviour?

Post by IVShilov »

Trying to understand how dump work on variable which not set

Code: Select all

newLISP v.10.7.1 32-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h
# (WindowsXP)
> (setq R '()) (time (push (dump x) R -1) 10 )(map unique (transpose R))
((5249584) (256) (5243024) (5243024) (5243024))
I get in such odd situation: RAM exhausted, error occurs, but no RAM was released and REPL still works.
See:

Code: Select all

(setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R)) 
()

ERR: not enough memory in function dump
> (delete 'x) # more than minute for evaluation
true
> # still 2Gb RAM
> (reset)
> # no effect
> (symbols)

ERR: not enough memory in function symbols
> (dotree (s MAIN) (delete s true))

ERR: not enough memory
> (sys-info)

ERR: not enough memory
> (delete 'x) # try again

ERR: not enough memory
> (exit)

ERR: not enough memory
Nothing helps and I have to kill process.
Bug or a feature?
I mean is it points to some newlisp lack or I must be more careful with all memory-related functions?

UPD:
This crash test is reproductible:

Code: Select all

> (setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R)) 
()

ERR: not enough memory in function dump
> (delete 'R) (reset)
- memory released and came back to normal values,
but repeat

Code: Select all

> (setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R)) 
lead to endless "ERR: not enough memory", 2Gb RAM and 50% CPU owned by newlisp.exe, and nothing helps except kill process.

Locked