Page 1 of 1

Error in (replace)?

Posted: Wed Jul 19, 2006 7:57 pm
by alex

Code: Select all

Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.

c:\newlisp>newlisp
newLISP v.8.7.10 on Win32 MinGW, execute 'newlisp -h' for more info.

>  (replace "(.{1})" (dup "0" 500)  "1" 0)
"1111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111"
>  (replace "(.{1})" (dup "0" 500000000)  "1" 0)

c:\newlisp>

Posted: Wed Jul 19, 2006 8:56 pm
by Lutz
This is a problem of memory management in MS Windows. (dup "0" 500000000) will try to allocate a huge amount of memory.

A UNIX system will start swapping and perhaps run out of memory.

Lutz

Posted: Thu Jul 20, 2006 4:01 am
by alex
Thanks.
It is bad "new" for me :-(