Run-Time Error "No Room in Heap"

Product Version(s): 3.30
Operating System:   MS-DOS
Flags: ENDUSER |
Last Modified: 12-MAY-1988    ArticleIdent: Q10860

Problem:
   I have developed a program that has about 150 subroutines (400K
code and 120K data). Most of the data is in common blocks, but the
error message "no room in heap" still is generated at run time.

Response:
   The following is a list of possible reasons for this error:

   1. There may not be enough memory in your machine. The maximum
memory you can have in your machine is 640K. You will constantly reach
your limit unless you have a full 640K (and perhaps even if you do)
because your data and code use 520K (400K for code, 120K for data).
   2. Something in your code may be using up DGROUP space. An error
indicating there is no room in the heap may occur when you are opening
a file in your program. Opening a file uses dynamic memory allocation,
which requires space from DGROUP. If there is not enough space left in
DGROUP, opening a file will result in a "no room in heap" error.
   3. Your format strings may be using up DGROUP space. If this is the
case, you could put your format strings in a character variables file
in a common block. Unfortunately, this action creates unreadable code,
but it is a possible workaround.
   4. Long parameter lists may be using up DGROUP space, which you
will have to break up.