dreamstreat / libkml

Automatically exported from code.google.com/p/libkml
Other
0 stars 0 forks source link

Memory leaks with VS2005 #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Doing this
// Add items to document.
//...
// then
KmlPtr kml(kmlFactory->CreateKml());
kml->set_feature(document);
2. Then calling any of these causes a memory leak (which looks like the
memory of all the items added to the document).
std::string kmlData = kmldom::SerializePretty(kml);
std::string kmlData = kmldom::SerializeRaw(kml);
kmlengine::KmlFilePtr kmlFile(kmlengine::KmlFile::CreateFromImport(kml));

What version of the product are you using? On what operating system?
Libkml-0.9.0 on Windows.

Did you run the unit test suite that comes with the project? Did all tests
pass?
Yes I ran the test suite. No the tests didn't all pass. See the attached
file. But I don't think the tests that failed affect my code.

Original issue reported on code.google.com by JRosanow...@gmail.com on 27 May 2009 at 1:49

Attachments:

GoogleCodeExporter commented 8 years ago
I just tried Libkml-1.0.0-alpha1 and got the same problem.

Original comment by JRosanow...@gmail.com on 27 May 2009 at 2:16

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It seems to be caused by the Xsd::schema_ singleton.
Xsd* Xsd::schema_ = NULL;

Xsd* Xsd::GetSchema() {
  if (schema_ == NULL) {
    schema_ = new Xsd;
  }
  return schema_;
}
Although there's only one call to this the leak appears multiple times in the 
debug
output. No matter what leak number I use with the watch variable
{,,msvcr80d.dll}_crtBreakAlloc it ends up on schema_ = new Xsd; within the call 
stack.
I couldn't find any mention of this in the documentation. If not considered a 
bug it
should be highlighted as a known issue for VS2005.

Original comment by JRosanow...@gmail.com on 27 May 2009 at 4:29

GoogleCodeExporter commented 8 years ago
See issue 78

Original comment by kml.b...@gmail.com on 28 May 2009 at 12:48

GoogleCodeExporter commented 8 years ago
Issue 144 has been merged into this issue.

Original comment by kml.b...@gmail.com on 19 Apr 2010 at 9:09