?
Solved

Adjusting heap size

Posted on 1997-02-21
1
Medium Priority
?
422 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
The article covers five tools all IT professionals should know about, as they up productivity by a great deal!
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…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

831 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