Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Adjusting heap size

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
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…
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). …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

636 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