Quantcast
Channel: Visual Leak Detector for Visual C++ 2008-2015
Viewing all articles
Browse latest Browse all 704

Edited Issue: False detection with static objects [10141]

$
0
0
In the code below VLD detects a memory leak if TestClass and getStaticObject are defined in a DLL. The DLL is built without VLD.

```
// some.dll

class TestClass
{
public:
TestClass()
{
buffer = new char[10];
}
~TestClass()
{
delete[] buffer;
}
private:
char* buffer;
};

TestClass& getStaticObject(void)
{
static TestClass object;
return object;
}

// ...

// end of some.dll

int main()
{
getStaticObject();
return 0;
}

```

Viewing all articles
Browse latest Browse all 704

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>