View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013908 | VTK | (No Category) | public | 2013-02-26 17:59 | 2013-04-05 18:56 | ||||
Reporter | Micah Chambers | ||||||||
Assigned To | Berk Geveci | ||||||||
Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013908: Memory Leak in the following code | ||||||||
Description | vtkDataReader.cxx has a memory leak here: 'decoded' is allocated but never deleted. Line 1749 of the git version. else { // read in newline vtkStdString s; my_getline(*(this->IS), s); for (int i=0; i<numTuples; i++) { for (int j=0; j<numComp; j++) { my_getline(*(this->IS), s); int length = static_cast<int>(s.length()); char* decoded = new char[length + 1]; int decodedLength = this->DecodeString(decoded, s.c_str()); vtkStdString decodedStr(decoded, decodedLength); ((vtkStringArray*)array)->InsertNextValue(decodedStr); } } } } | ||||||||
Tags | No tags attached. | ||||||||
Project | TBD | ||||||||
Type | performance | ||||||||
Attached Files | vtkDataReader.patch [^] (936 bytes) 2013-02-26 18:16 [Show Content]
testcorr.vtk [^] (290,635 bytes) 2013-02-26 18:28 | ||||||||
Relationships | |
Relationships |
Notes | |
(0030388) Jean-Christophe Fillion-Robin (manager) 2013-02-26 18:06 |
Hi Micah, Thanks for pointing this out. Would be great if you could submit a patch that would be discussed by the community :) See http://www.vtk.org/Wiki/VTK/Git/Develop [^] |
(0030389) Micah Chambers (reporter) 2013-02-26 18:16 |
Yeah I'm testing the patch now... |
(0030390) Micah Chambers (reporter) 2013-02-26 18:28 |
Yeah, ran valgrind on my code and it works. I don't have sample code though, because its part of kind of a big codebase. I will however attach a sample dataset where the bug occurs. Reading the dataset with vtkDataSetReader will definitely recreate the bug. While I was there I went ahead and added delete[] to several other 'decoded' variables. I think this was a copy-and-paste error. |
(0030398) Berk Geveci (administrator) 2013-03-02 20:22 |
Committed a fix for this to Gerrit review. Please see http://review.source.kitware.com/#/t/2278 [^] Feel free to register to Gerrit and comment. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-02-26 17:59 | Micah Chambers | New Issue | |
2013-02-26 18:06 | Jean-Christophe Fillion-Robin | Note Added: 0030388 | |
2013-02-26 18:16 | Micah Chambers | File Added: vtkDataReader.patch | |
2013-02-26 18:16 | Micah Chambers | Note Added: 0030389 | |
2013-02-26 18:28 | Micah Chambers | File Added: testcorr.vtk | |
2013-02-26 18:28 | Micah Chambers | Note Added: 0030390 | |
2013-03-02 20:21 | Berk Geveci | Assigned To | => Berk Geveci |
2013-03-02 20:21 | Berk Geveci | Status | backlog => tabled |
2013-03-02 20:22 | Berk Geveci | Note Added: 0030398 | |
2013-03-02 20:22 | Berk Geveci | Status | tabled => customer review |
2013-03-02 20:22 | Berk Geveci | Resolution | open => fixed |
2013-04-05 18:56 | Berk Geveci | Status | customer review => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |