C++/VB - setting LFH (low fragmentation heap) on handles returned by getprocessheaps()
Asked By ted
16-Feb-08 04:49 AM

I'm running this simple C program (see below, compiled with cl.exe
version 14.00, XP SP2) and see the following output:
Number of heaps returned by GetProcessHeaps() = 4
Heap 0: Succeeded (1) setting LFH
Heap 1: Succeeded (1) setting LFH
Heap 2: Failed (0) setting LFH, error = 31
Heap 3: Succeeded (1) setting LFH
Q: What are these 4 heaps? Do they have names (and how can I get the
names)?
Q: Which one corresponds to the one used by malloc()?
Q: Why does Heap 2 fail?
int main()
{
HANDLE aHeap[101] ;
ULONG HeapFragValue = 2 ;
BOOL retval ;
DWORD ii, nHeaps ;
nHeaps =(int)GetProcessHeaps( 100, aHeap ) ; printf( "\nNumber
of heaps returned by GetProcessHeaps() = %d", nHeaps ) ;
for ( ii = 0 ; ii < nHeaps ; ii++ )
{
retval = HeapSetInformation( aHeap[ii],
HeapCompatibilityInformation,
&HeapFragValue,
sizeof(HeapFragValue) ) ;
if ( retval != 0 )
{
printf( "\nHeap %d: Succeeded (%d) setting LFH",
ii, retval ) ;
}
else
{
printf( "\nHeap %d: Failed (%d) setting LFH, error
= %d", ii, retval, GetLastError() ) ;
}
}
return 0 ;
}
0f, &mesh, NULL); Win32 DirectX Graphics Discussions D3DXMatrixLookAtLH (1) D3DXMatrixRotationY (1) D3DXCreateCylinder (1) OnD3D9FrameRender (1) XP (1) IDirect3DDevice9 (1) DrawIndexedPrimitive (1) UnlockVertexBuffer (1) [Please do not mail me a copy of M, T1836%T<FEX5')A;G-L871I;VXH)FUA = % = O<FQD+#$P+C!F+# N, &8L, "XP M9BD[#0H)<&0S9$1E = FEC92T^4V5T5')A;G-F;W)M*"!$, T144U]73U), 1"PF C P, # P, #LL"B @.38N, S Y.38W.RTW, 2XR, 3<W, 3([ M, "XP, # P, # [+ H@("TY-BXS, #DY-C<[-S$N, C$W-S$R.S N, # P Y, 3$W.RP*(" M M.38N, S Y.38W.RTW, 2XR, 3<W, 3([, "XP, # P, # [+ H@(#DV+C, P.3DV-SLM M-S$N, C$W-S$R.S CLP+C P, # P, #LL"B @+3DV+C, P.3DV-SLW, 2XR, 3<W, 3([, "XP, # P M, # [+ H@("TY-BXS, #DY-C<[-S$N, C$W-S$R.S$Q C0S.3$Q-SLL"B @+3DV+C, P.3DV-SLW M, 2XR, 3<W, 3([, "XP, # P, # [+ H@("TY-BXS, #DY-C<[+3<Q+C(Q-S<Q, CLQ M, 3 3@L, "PQ.3LL"B @, SLQ.2PV+#$X.SL*"B @ M365S:$YO<FUA;', @('L*(" @-CL*(" @, "XP, # P, # [, "XP, # P, # [+3$N M, # P, # P.RP*(" @, "XP, # P, # [, "XP, # P, # [, 2XP, # P, # [+ H@(" P
happens? And if I click, it does not do anything also. Win32 DirectX Graphics Discussions XP (1) Ghz (1) E871E169F96 (1) Notebook (1) 38P.S (1) Dxut (1) Bits (1) TME C!F M+" P+C!F+"TS, "XP9B I.PT*(" @($0S1%A614-43U(S('95<%9E8R@@, "XP M9BP@, 2XP9BP@, "XP9B I.PT*(" @($0S1%A-051225A!, 38@;6%T5FEE = SL- M"B @("!$, T1836%T<FEX3&]O P+C P, # P, #LP+C P, # P M, #LP+C P, # P, #LL"B @, "XP, # P, # [, "XP, # P, # [, "XP, # P, # [+ H@ M(# N, # P, # P.S N, # P, # P.S N, # P, # P.RP P+C P, # P, #LP+C P M, # P, #LP+C P, # P, #LL"B @, "XP, # P, # [, "XP, # P, # [, "XP, # P, # [ M+ H@(# N, # P, # P.S N, # P, # P.S N, # P, # P.RP