Solved

Adjusting heap size

Posted on 1997-02-21
1
405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
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). …
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.

717 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