DynamoRIO / DynamoRIO/drmemory

Dr. Memory reports possible leaks on string16 and wstring

Open
#634 2 comments 0 reactions 0 assignees View on GitHub
Component-LeakCheck Migrated Priority-Medium
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on October 20, 2011 11:17:58_

Repro:
---test.cpp---
#include

typedef std::basic_string string16;
std::string *ptr8;
string16 *ptr16;
std::wstring *ptr32;

class MyClass {
public:
~MyClass() { }
} *new_array;

int main(void) {
ptr8 = new std::string;
*ptr8 += "ASDASDASDASDASDASDASDSAD";

ptr16 = new string16;
for (int i = 0; i < ptr8->size(); i++)
_ptr16 += (unsigned char)(_ptr8)[i];

ptr32 = new std::wstring;
*ptr32 += L"ASDASDASDASDASDASDASDSAD";

new_array = new MyClass[42];
}
--------------
...
On Linux,
...
~~Dr.M~~ ERRORS FOUND:
...
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of leak(s)
~~Dr.M~~ 2 unique, 2 total, 158 byte(s) of possible leak(s)
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of still-reachable allocation(s)
...

a) Shouldn't be possible leaks
b) Why 0 still-reachable allocations?!

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=634_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.