How to increase HEAP size in VC++ 6.0 environment

N

nvjoglekar

Hi All

My program needs a lot of memory and after allocating some using NEW
statement, it returns NULL for any new object created. I guess that is
becuase of the heap size limitation of the Visual Studio which stands
at 1MB. I need to increase it. One option I found was to set
/HEAP:memory in the Link options of project setting. Bur it didn't
seem to work. I am getting same problem again.
Dows anybody has a opinion about this.

regards
Nikhil
 
P

Perry S. Morris

Nikhil,

Look at the Win32 API calls VirtualAlloc() and VirtualFree(). Use these
instead of new/delete for large blocks of memory.

On a side note, this forum is suppose to be c++ only --- not OS dependent
or compiler dependent.

Anyway, I hope those two API calls will help you. ;-)

Perry
 
C

Christopher Benson-Manica

nvjoglekar said:
My program needs a lot of memory and after allocating some using NEW
statement, it returns NULL for any new object created. I guess that is
becuase of the heap size limitation of the Visual Studio which stands
at 1MB. I need to increase it. One option I found was to set
/HEAP:memory in the Link options of project setting. Bur it didn't
seem to work. I am getting same problem again.
Dows anybody has a opinion about this.

If you do indeed require a larger heap, you must seek help elsewhere.

http://www.slack.net/~shiva/welcome.txt
http://www.parashift.com/c++-faq-lite/
 
J

John Carson

nvjoglekar said:
Hi All

My program needs a lot of memory and after allocating some using NEW
statement, it returns NULL for any new object created. I guess that is
becuase of the heap size limitation of the Visual Studio which stands
at 1MB. I need to increase it. One option I found was to set
/HEAP:memory in the Link options of project setting. Bur it didn't
seem to work. I am getting same problem again.
Dows anybody has a opinion about this.

regards
Nikhil

VC++ specific questions are off-topic here. You should post them at

microsoft.public.vc.language

I rather doubt, however, that your problem is really a VC++ configuration
problem. Two points:

1. The 1Mb default heap size is just an initial value. The heap is enlarged
as needed (as a test, I just allocated 100Mb without a problem in spite of
using the default heap settings).

2. NEW is not part of the C++ language. The appropriate keyword is new
(lower case).

I suspect that your problem is a language one, but it is impossible to be
more specific without seeing your code. See if you can create a compileable
sample that exhibits the problem. Of course, the amount of memory available
on any system is limited, so it is possible to exceed it. But a normal
correctly written program is unlikely to do so.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top