PRB: Avoiding R6009 "Not Enough Space for Environment" Error

ID: Q50714


The information in this article applies to:


SYMPTOMS

In the Microsoft C and Visual C++ products listed above, the following error message may be generated:

R6009: Not Enough Space For Environment


CAUSE

The "R6009: Not Enough Space For Environment" run-time error is caused when a program successfully loads into memory and then attempts to load a copy of the environment and the argument list into the near heap. If the near heap does not have enough room for one, the other, or both, R6009 is generated.


RESOLUTION

The following are four ways to work around the problem:


MORE INFORMATION

In standard Microsoft C programs, the functions _setargv() and _setenvp() attempt to set up the argument vector and the environment vector, respectively. Both of these vectors are allocated in the near heap. If the program has a full or nearly full near heap, the vectors will not be set up, thereby giving the error.

Additional query words: 6.00 6.00a 6.00ax 7.00 8.00 8.00c 1.00 1.50


Keywords          : kb16bitonly 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 5, 1999