Microsoft KB Archive/23405

getmqq Generates “No Room in Heap” Error in Pascal 4.00 PSS ID Number: Q23405 Article last modified on 03-01-1991 PSS database name: S_PasCal

3.3x

MS-DOS

Question:

The program below attempts to allocate 60,000 bytes on the long heap using Getmqq. The run-time generates error “2001: No Room In Heap” on the following statement:

point:=getmqq(w) {w=60000 and point is an ads variable}

The program is as follows:

{$entry+} {$ line+ } Program dan (input,output); type rec_t = record char1 : char; char2 : char; end; big_array_t = array [1..30000] of rec_t; var point : ads of big_array_t; i : integer; w : word;

FUNCTION GETMQQ (wants : WORD):ADSMEM;EXTERN; procedure dismqq (wants : ADSMEM);EXTERN;

begin w := 60000; point := getmqq (w); <——————-ERROR for i := 4000 to 30000 do begin point .char1 := ‘a’; end; dismqq (point); writeln (‘normal eoj’); end.

My system has 531,296 bytes free. I thought I could allocate up to 64K with Getmqq. Why am I getting this error message?

Response:

This problem is due to a code generation error in Pascal version 3.32 and earlier. There is no workaround other than upgrading to version 4.00.

Microsoft has confirmed this to be a problem in version 3.32. This problem was corrected in Microsoft Pascal version 4.00.

Copyright Microsoft Corporation 1991.