Does it happen when you running the process under debugger or all the times ?
-- This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Yes, I test setting the low fragmentation on the default heap outside the debugger (writing a trace file) and it works. But I also test setting low fragmention on other heap created by myself (not the default process heap), and it doesn't work, both within the debugger and outside.
> Does it happen when you running the process under debugger or all the times > ?
> -- > This posting is provided "As Is" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm
> "WDev" <t...@hotmail.com> wrote in message > news:lrJN9.85774$qF3.7194@sccrnsc04... > > I am trying to use the Low Fragmentation Heap on the default heap on a XP > > platform.
> > The problem is that HeapSetInformation always return FALSE with a > > GetLastError = 31 (ERROR_GEN_FAILURE)
The debugger enable certain flags on all the heaps, so that certain common problems can be caught. The LowFrag Heap is a piece of code really hard to debug when you have corruptions and/or double free and or reuser-after-delete, while the regular heap is somehow more resistent to these problems. (is you have a heap corruption on the regular heap there are 20%-30% chances to find the culprit by analysis on the stack and the heap, while with LowFrag the chances are near zero, that's why its not recomended for debug purposes).
Can I see the code you use to create the private Heaps ? I wonder if you are putting some incompatible flags there.
-- This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
> Yes, I test setting the low fragmentation on the default heap outside the > debugger (writing a trace file) and it works. But I also test setting low > fragmention on other heap created by myself (not the default process heap), > and it doesn't work, both within the debugger and outside.
> Do you know why this happend?.
> "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > mensaje news:efHihh2qCHA.2308@TK2MSFTNGP09... > > Does it happen when you running the process under debugger or all the > times > > ?
> > -- > > This posting is provided "As Is" with no warranties, and confers no > rights. > > Use of included script samples are subject to the terms specified at > > http://www.microsoft.com/info/cpyright.htm
> > "WDev" <t...@hotmail.com> wrote in message > > news:lrJN9.85774$qF3.7194@sccrnsc04... > > > I am trying to use the Low Fragmentation Heap on the default heap on a > XP > > > platform.
> > > The problem is that HeapSetInformation always return FALSE with a > > > GetLastError = 31 (ERROR_GEN_FAILURE)
The flag that I am using when creating the particular heap is HEAP_NO_SERIALIZE. Do you know if that could cause the fail?, do you know why?. Thanks for your answers.
Anyway I post you the code below. I create the Heap on a Class (CMemAlloc), the first method create the heap (retrying with a inferior size if fail), and the second simply set the Low fragmentation flag (note that both use the common class data member m_hHeap as heap handle).
> The debugger enable certain flags on all the heaps, so that certain common > problems can be caught. > The LowFrag Heap is a piece of code really hard to debug when you have > corruptions and/or double > free and or reuser-after-delete, while the regular heap is somehow more > resistent to these problems. > (is you have a heap corruption on the regular heap there are 20%-30% chances > to find the culprit > by analysis on the stack and the heap, while with LowFrag the chances are > near zero, > that's why its not recomended for debug purposes).
> Can I see the code you use to create the private Heaps ? > I wonder if you are putting some incompatible flags there.
> -- > This posting is provided "As Is" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm
> > Yes, I test setting the low fragmentation on the default heap outside the > > debugger (writing a trace file) and it works. But I also test setting low > > fragmention on other heap created by myself (not the default process > heap), > > and it doesn't work, both within the debugger and outside.
> > Do you know why this happend?.
> > "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > > mensaje news:efHihh2qCHA.2308@TK2MSFTNGP09... > > > Does it happen when you running the process under debugger or all the > > times > > > ?
> > > -- > > > This posting is provided "As Is" with no warranties, and confers no > > rights. > > > Use of included script samples are subject to the terms specified at > > > http://www.microsoft.com/info/cpyright.htm
> > > "WDev" <t...@hotmail.com> wrote in message > > > news:lrJN9.85774$qF3.7194@sccrnsc04... > > > > I am trying to use the Low Fragmentation Heap on the default heap on a > > XP > > > > platform.
> > > > The problem is that HeapSetInformation always return FALSE with a > > > > GetLastError = 31 (ERROR_GEN_FAILURE)
If you are choosing no serialization, then you don't need the LowFragHeap. So, your actual problem is that flag.
On the bigger picture, the LowFragHeap is a heap has features such as: -o- Thread affine allocation in the average case (this guarantees cosistency with virtual no cost for lock) -o- Low Fragmentation and almost constant working set for applications with an istogram of allocations centered in the low-size part of the graph, and well contained in the low-size part of the graph.
If you are claiming you known how to lock you heap, then you are possibly destroying the LowfragHeap heap algorithms, hence there is no point using them. Or, in different terms, if you don't need the lock services from the heap, it means that your application is single threaded anyway, or you have a per-thread heap with no cross heap contaminations problem in your code.
Please reflect on the usage of the private heaps, the locking strategy of the allocator, the memory graph usage runtime and the frequency of block reuse before throwing in the LowFrag heap.
-- This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
> The flag that I am using when creating the particular heap is > HEAP_NO_SERIALIZE. Do you know if that could cause the fail?, do you know > why?. Thanks for your answers.
> Anyway I post you the code below. I create the Heap on a Class (CMemAlloc), > the first method create the heap (retrying with a inferior size if fail), > and the second simply set the Low fragmentation flag (note that both use the > common class data member m_hHeap as heap handle).
> "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > mensaje news:esfOy92qCHA.1964@TK2MSFTNGP09... > > The debugger enable certain flags on all the heaps, so that certain common > > problems can be caught. > > The LowFrag Heap is a piece of code really hard to debug when you have > > corruptions and/or double > > free and or reuser-after-delete, while the regular heap is somehow more > > resistent to these problems. > > (is you have a heap corruption on the regular heap there are 20%-30% > chances > > to find the culprit > > by analysis on the stack and the heap, while with LowFrag the chances are > > near zero, > > that's why its not recomended for debug purposes).
> > Can I see the code you use to create the private Heaps ? > > I wonder if you are putting some incompatible flags there.
> > -- > > This posting is provided "As Is" with no warranties, and confers no > rights. > > Use of included script samples are subject to the terms specified at > > http://www.microsoft.com/info/cpyright.htm
> > > Yes, I test setting the low fragmentation on the default heap outside > the > > > debugger (writing a trace file) and it works. But I also test setting > low > > > fragmention on other heap created by myself (not the default process > > heap), > > > and it doesn't work, both within the debugger and outside.
> > > Do you know why this happend?.
> > > "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > > > mensaje news:efHihh2qCHA.2308@TK2MSFTNGP09... > > > > Does it happen when you running the process under debugger or all the > > > times > > > > ?
> > > > -- > > > > This posting is provided "As Is" with no warranties, and confers no > > > rights. > > > > Use of included script samples are subject to the terms specified at > > > > http://www.microsoft.com/info/cpyright.htm
> > > > "WDev" <t...@hotmail.com> wrote in message > > > > news:lrJN9.85774$qF3.7194@sccrnsc04... > > > > > I am trying to use the Low Fragmentation Heap on the default heap on > a > > > XP > > > > > platform.
> > > > > The problem is that HeapSetInformation always return FALSE with a > > > > > GetLastError = 31 (ERROR_GEN_FAILURE)
Well, that the case: I have a per-thread exclusive heap, that is because a use the HEAP_NO_SERIALIZE on it (there isn't needed any locking). Additionaly that heap it used normally for smalls allocations (< 16k), with a high reuse rate(frecuent "frees" and new allocations), so that is the reason because I want to use the Low Fragmentation Heap. I still think it would be usefull for that (based on your second named feature).
Thanks for the information anyway. Do you know where I could find extended information about the Low Frag Heap?, since I didn't find in the documentation information like you just had given to me.
> If you are choosing no serialization, then you don't need the LowFragHeap. > So, your actual problem is that flag.
> On the bigger picture, the LowFragHeap is a heap has features such as: > -o- Thread affine allocation in the average case (this guarantees cosistency > with virtual no cost for lock) > -o- Low Fragmentation and almost constant working set for applications with > an istogram > of allocations centered in the low-size part of the graph, and well > contained in the low-size part of the graph.
> If you are claiming you known how to lock you heap, > then you are possibly destroying the LowfragHeap heap algorithms, > hence there is no point using them. > Or, in different terms, if you don't need the lock services from the heap, > it means that your application is single threaded anyway, > or you have a per-thread heap with no cross > heap contaminations problem in your code.
> Please reflect on the usage of the private heaps, the locking strategy of > the allocator, > the memory graph usage runtime and the frequency of block reuse > before throwing in the LowFrag heap.
> -- > This posting is provided "As Is" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm
> "WDev" <t...@hotmail.com> wrote in message > news:0W0O9.492640$QZ.74249@sccrnsc02... > > The flag that I am using when creating the particular heap is > > HEAP_NO_SERIALIZE. Do you know if that could cause the fail?, do you know > > why?. Thanks for your answers.
> > Anyway I post you the code below. I create the Heap on a Class > (CMemAlloc), > > the first method create the heap (retrying with a inferior size if fail), > > and the second simply set the Low fragmentation flag (note that both use > the > > common class data member m_hHeap as heap handle).
> > "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > > mensaje news:esfOy92qCHA.1964@TK2MSFTNGP09... > > > The debugger enable certain flags on all the heaps, so that certain > common > > > problems can be caught. > > > The LowFrag Heap is a piece of code really hard to debug when you have > > > corruptions and/or double > > > free and or reuser-after-delete, while the regular heap is somehow more > > > resistent to these problems. > > > (is you have a heap corruption on the regular heap there are 20%-30% > > chances > > > to find the culprit > > > by analysis on the stack and the heap, while with LowFrag the chances > are > > > near zero, > > > that's why its not recomended for debug purposes).
> > > Can I see the code you use to create the private Heaps ? > > > I wonder if you are putting some incompatible flags there.
> > > -- > > > This posting is provided "As Is" with no warranties, and confers no > > rights. > > > Use of included script samples are subject to the terms specified at > > > http://www.microsoft.com/info/cpyright.htm
> > > > Yes, I test setting the low fragmentation on the default heap outside > > the > > > > debugger (writing a trace file) and it works. But I also test setting > > low > > > > fragmention on other heap created by myself (not the default process > > > heap), > > > > and it doesn't work, both within the debugger and outside.
> > > > Do you know why this happend?.
> > > > "Ivan Brugiolo [MSFT]" <ivanb...@online.microsoft.com> escribió en el > > > > mensaje news:efHihh2qCHA.2308@TK2MSFTNGP09... > > > > > Does it happen when you running the process under debugger or all > the > > > > times > > > > > ?
> > > > > -- > > > > > This posting is provided "As Is" with no warranties, and confers no > > > > rights. > > > > > Use of included script samples are subject to the terms specified at > > > > > http://www.microsoft.com/info/cpyright.htm
> > > > > "WDev" <t...@hotmail.com> wrote in message > > > > > news:lrJN9.85774$qF3.7194@sccrnsc04... > > > > > > I am trying to use the Low Fragmentation Heap on the default heap > on > > a > > > > XP > > > > > > platform.
> > > > > > The problem is that HeapSetInformation always return FALSE with a > > > > > > GetLastError = 31 (ERROR_GEN_FAILURE)