Path: news.cs.au.dk!not-for-mail From: "Sascha Kimmel \(tricos Mediaservice\)" Newsgroups: comp.lang.beta Subject: Severe bug in array implementation (nti) - extendBlock: VirtualAlloc failed - Out of memory Date: 20 Feb 2000 10:38:58 -0000 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 96 Approved: mailtonews@cs.au.dk Distribution: world Message-ID: <20000220103858.20518.qmail@noatun.mjolner.dk> Reply-To: "Sascha Kimmel \(tricos Mediaservice\)" NNTP-Posting-Host: daimi.cs.au.dk X-Trace: xinwen.cs.au.dk 951043154 12687354 255.255.255.255 (20 Feb 2000 10:39:14 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 20 Feb 2000 10:39:14 GMT Xref: news.cs.au.dk comp.lang.beta:12243 Hello, I found a severe bug in the array implementation. The following program gives an access violation during execution on Windows (other platforms not tested): >>>>> ORIGIN '~beta/basiclib/betaenv'; -- program: descriptor -- (** BETA CRASH TEST **) (# a:[0]@char; do (for i:32768 repeat (** might also be a value smaller than 2^15 with at east about 23850 for chars **) 'Array@char has is set to a length of '->putText; i->putInt; ' bytes.'->putLine; 1->a.extend; '@'->a[a.range]; for); 'Ready.'->putLine; stop; #) <<<<< The same problem also occurs when using an array of integer and probably every time a STATIC OBJECT is used instead of a REFERENCE as an array object. It works well with an array of ^text. After running the program shown above the following output is displayed after some time: [...] Array@char has is set to a length of 23844 bytes. Array@char has is set to a length of 23845 bytes. Array@char has is set to a length of 23846 bytes. extendBlock: VirtualAlloc failed with GetLastError 8 Array@char has is set to a length of 23847 bytes. Array@char has is set to a length of 23848 bytes. During execution it seems that a vast amount of memory is used because of heavy harddisk access (swap file?) Afterwards a BETA execution "Access violation" occurs, the dump file says: >>>>> Beta execution aborted: Access violation. Call chain: (nti_ms) Current object is zero! [ EXTERNAL ACTIVATION PART (address 0x4143e9 <_AOAAllocateFromFreeList+0x329>) ] # Beta execution aborted: Access violation # Error during dump: Reference is none. Aborting. <<<<< The WINAPI function GetLastError returns 8 which is defined in winerror.h as >>>>> // MessageId: ERROR_NOT_ENOUGH_MEMORY // // MessageText: // // Not enough storage is available to process this command. // #define ERROR_NOT_ENOUGH_MEMORY 8L // dderror <<<<< A workaround is to use REFERENCES instead of OBJECTS. The error "extendBlock: VirtualAlloc failed..." originates from betarun.lib and betarun_v.lib, making it impossible for any BETA programmer to trace the problem. I hope that an updated version of betarun.lib and betarun_v.lib will be available soon - it is normal to use e.g. integer OBJECTS instead of references. Any feedback especially from MJOLNER is welcome. Regards, Sascha Kimmel