MantisBT - VTK
View Issue Details
0003643VTK(No Category)public2006-08-21 02:342006-09-17 07:57
wenwu yang 
Mathieu Malaterre 
lowminoralways
closedno change required 
 
 
0003643: an error in function "void* vtkHeap::AllocateMemory(size_t n)"
In this function, there are the following codes:

#...

if ( ! this->Current || (this->Position + n) >= this->Current->Size )
    {
    this->Add(blockSize);
    }

#...

I think "(this->Position + n) >= this->Current->Size )" should be replaced by "(this->Position + n) > this->Current->Size )".

For example, there is a block with "pos=0, size=5", which can satisfy quest of n<=5 but not n<=4.
No tags attached.
Issue History
2011-06-16 13:11Zack GalbreathCategory => (No Category)

Notes
(0004944)
   
2006-09-17 07:55   
I believe the >= is correct. If pos=0 and n=4 and size=4 then yes we need to reallocate. Because size=4 means we satisfy only n= 0,1,2,3

Closing the bug. Only reopen if you can reproduce in a small test.
(0004945)
Mathieu Malaterre   
2006-09-17 07:57   
I believe the code is correct. Ex: pos=0, n=5 and size=5. Then in this case we need to reallocate, because size=5 means we can only satisfy n= 0,1,2,3,4 but not n=5

Closing bug, reopen if you have an example which exhibit the issue.