HighTechTalks DotNet Forums  

Low-Fragmentation Heap

Visual Studio.net (General) microsoft.public.vsnet.general


Discuss Low-Fragmentation Heap in the Visual Studio.net (General) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ralf Tobel
 
Posts: n/a

Default Low-Fragmentation Heap - 10-26-2005 , 11:15 AM






Hello,

I'm desperatly trying to switch on the low-fragmentation heap for the crt
heap in C++ in VS.NET 2003 on a Windows XP SP2 machine with the following
code:

ULONG HeapFragValue = 2;
int ret = HeapSetInformation((HANDLE)_get_heap_handle(),
HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));

It always returns 0 which means according to the documentation that it
didn't succeeded.

So I tried to create a new heap to test if it's a problem with the crt heap:

HANDLE hh = HeapCreate(0, 0, 0);
ULONG HeapFragValue = 2;
int ret = HeapSetInformation(hh, HeapCompatibilityInformation,
&HeapFragValue, sizeof(HeapFragValue));

This also returns 0.

So what's the trick?

Any hints are welcome.

Ralf



Reply With Quote
  #2  
Old   
Patrice
 
Posts: n/a

Default Re: Low-Fragmentation Heap - 10-26-2005 , 12:15 PM






Have you tried to use GetLastError and/or to see if HeapCreate fails for the
second one ?
(and I would try rather a group such as
microsoft.public.dotnet.languages.vc).

--
Patrice

"Ralf Tobel" <rtobel (AT) abc (DOT) com> a écrit dans le message de
news:eBqq%23gk2FHA.632 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Quote:
Hello,

I'm desperatly trying to switch on the low-fragmentation heap for the crt
heap in C++ in VS.NET 2003 on a Windows XP SP2 machine with the following
code:

ULONG HeapFragValue = 2;
int ret = HeapSetInformation((HANDLE)_get_heap_handle(),
HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue));

It always returns 0 which means according to the documentation that it
didn't succeeded.

So I tried to create a new heap to test if it's a problem with the crt
heap:

HANDLE hh = HeapCreate(0, 0, 0);
ULONG HeapFragValue = 2;
int ret = HeapSetInformation(hh, HeapCompatibilityInformation,
&HeapFragValue, sizeof(HeapFragValue));

This also returns 0.

So what's the trick?

Any hints are welcome.

Ralf





Reply With Quote
  #3  
Old   
Ralf Tobel
 
Posts: n/a

Default Re: Low-Fragmentation Heap - 10-26-2005 , 02:01 PM



Quote:
Have you tried to use GetLastError and/or to see if HeapCreate fails for
the
second one ?
HeapCreate succeeds and the error code for HeapSetInformation is 31: A
device attached to the system is not functioning.

Quote:
(and I would try rather a group such as
microsoft.public.dotnet.languages.vc).
Good idea. Thanks.




Reply With Quote
  #4  
Old   
Ralf Tobel
 
Posts: n/a

Default Re: Low-Fragmentation Heap - 10-27-2005 , 07:10 AM



Problem solved.

It only doesn't work if you start the application inside the debugger.

Ralf



Reply With Quote
  #5  
Old   
ch0kee
 
Posts: n/a

Default RE: Low-Fragmentation Heap - 03-06-2010 , 01:01 AM



If you want to use LFH in debug, add (or set, if exists) _NO_DEBUG_HEAP environment variable (plain windows environment variable) with value 1
_NO_DEBUG_HEAP = 1


From http://www.developmentnow.com/g/54_2005_10_0_0_624698/Low-Fragmentation-Heap.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.