![]() |
【转帖】memory leaks in exhostappservices.cpp
memory leaks in exhostappservices.cpp
memory leaks in exhostappservices.cpp in exhostappservices.cpp in dwgdirect 2.1.0, there are a number of places where 'delete' is being used instead of 'delete[]' that are likely to cause memory leaks. these include: line #260: code: char* lpdata = new char[ndatasize]; ... delete lpdata; line #295, 296 code: tchar* lpvalname = new tchar[nvalnamesize]; lpbyte lpdata = new byte[ndatasize]; ... delete lpvalname; delete lpdata; i think for a correct coding perspective this is correct, however since the arrays are simple characters arrays, this would not produce memory leaks as i understand it. (ie char's dont have destructors). also according do ibm documentation : the result of deleting an array object with delete is undefined. so to be safe, i agree, from both a consistency point & and documentation point. cheers jason quote: originally posted by tenbrink in exhostappservices.cpp in dwgdirect 2.1.0, there are a number of places where 'delete' is being used instead of 'delete[]' that are likely to cause memory leaks. these include: line #260: code: char* lpdata = new char[ndatasize]; ... delete lpdata; line #295, 296 code: tchar* lpvalname = new tchar[nvalnamesize]; lpbyte lpdata = new byte[ndatasize]; ... delete lpvalname; delete lpdata; last edited by janderssen; 2nd november 2006 at 08:32 pmfff">. we'll correct these places, though that is, as jason correctly states, just a consistency matter. btw - how did you discover them - perhaps there is some tool? vladimir |
所有的时间均为北京时间。 现在的时间是 02:23 PM. |