|
Notes |
|
|
(0025602)
|
|
Sean McBride
|
|
2011-02-28 11:00
|
|
|
I once looked at fixing some of the PLY leaks, but gave up because the code is, umm, scary. |
|
|
|
(0025625)
|
|
Petr Petrov
|
|
2011-03-03 02:20
|
|
Small advise: the allocation is here:
void vtkPLY::ascii_get_element(PlyFile *plyfile, char *elem_ptr)
{
... skipped some code...
/* do we need to setup for other_props? */
if (elem->other_offset != NO_OTHER_PROPS) {
char **ptr;
other_flag = 1;
/* make room for other_props */
other_data = (char *) myalloc (elem->other_size); // ALLOCATION IS HERE!!!!!
/* store pointer in user's structure to the other_props */
ptr = (char **) (elem_ptr + elem->other_offset);
*ptr = other_data;
}
else
other_flag = 0;
...code continues.... |
|
|
|
(0025626)
|
|
Petr Petrov
|
|
2011-03-03 02:21
|
|
|
also it is possible to use vtkHeap to track all memory leaks... but I am not sure |
|
|
|
(0025631)
|
|
Petr Petrov
|
|
2011-03-03 07:06
|
|
it seems that I have fixed these memory leaks.
just two lines change:
other_data = (char *) myalloc (elem->other_size); // ALLOCATION IS HERE!!!!!
change to
other_data = (char *) plyHeap->AllocateMemory(elem->other_size); // fixed, use vtkHeap to free memory as last resot
and another the similar change in a code place little below.
I have attached the modified source file (IO\vtkPLY.cxx) |
|
|
|
(0025668)
|
|
Robert Maynard
|
|
2011-03-04 10:12
|
|
Merge topic '11901-ply-memory-leaks'
92c370f Fix memory leaks in the PLY implementation. Thanks to Petr Petrov. |
|