Solved

Adjusting heap size

Posted on 1997-02-21
1
379 Views
Last Modified: 2013-12-28
I am porting an application to Windows NT 4.0 environment from Windows
95, and the application needs ~4-5MB of heap space.

Since the default heap space allocation is 1MB for an NT process, I have
tried to change this using the /HEAP - switch in the project options
setting Visual C++ with no luck. After 1MB has been allocated
malloc/calloc fails and returns a null pointer, which again causes the
process to terminate.

Does anyone know if NT overrides the HEAP - switch in Visual C++? If the
heap is allocated in the top 2GB - region of the NT memory map, I can
believe this. But then how can I change this default size? Is there an
initialisation file or other setting I have overlooked?

Please reply by email to: os@cs.strath.ac.uk

Thanks in advance for any reply,

Yours sincerely,

Oyvind Stromme
0
Comment
Question by:oyvind
1 Comment
 

Accepted Solution

by:
gbjbaanb earned 100 total points
ID: 1776855
One way is to use the Win32 API function HeapCreate. The help says that the amount of space required for a private heap is limited only by available memory, better stil, if you specify a maximum size of 0, the heap will grow until it runs out of mem.

Otherwise, if you need to increase the size of the System or Desktop heaps, look in the MSDN for 'How to Increase Windows NT System and Desktop Heap Sizes'. You'll have to change the registry to provide yourself with more space.

If you don't have access to MSDN, it says to change the following key: HKEY_LOCAL_MACHINE\
   System\
   CurrentControlSet\
   Control\
   Session Manager\
   SubSystems\
   Windows

Under this entry, you will find a string similar to the following (the slash (/) is a line continuation charater):
 
%SystemRoot%\system32\csrss.exe /
   ObjectDirectory=\Windows /
   SharedSection=1024,512 /
   Windows=On /
   SubSystemType=Windows /
   ServerDll=basesrv,1 /
   ServerDll=winsrv:GdiServerDllInitialization,4 /
   ServerDll=winsrv:UserServerDllInitialization,3 /
   ServerDll=winsrv:ConServerDllInitialization,2 /
   ProfileControl=Off /
   MaxRequestThreads=16

Change the SharedSection value from 1024 (the system heap, your current limitation) to a bigger value. The second value there is the desktop heap.

MS says that you'll have to increase the paging space to accomodate the amount you specify.

Cheers, Andy.

0

Featured Post

Being driven mad by email signature updates?

Having to make a change to your users’ email signatures, yet again? Feel like your head is going to explode? Rely on an Exclaimer email signature management solution to make the process simple!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now