Solved

Adjusting heap size

Posted on 1997-02-21
1
373 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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

10 Experts available now in Live!

Get 1:1 Help Now