Can anyone explain why I get a memory leak (+1.55 kB) with code below and what am I supposed to do to avoid it ?
void TestGuid() {
UUID id;
ZeroMemory(&id, sizeof(UUID));
UuidCreate(&id);
}
int _tmain(int argc, _TCHAR* argv[]) {
TestGuid(); // Memory Snapshot 1 here
return 0; // Memory Snapshot 2 here
}
The very first call of UuidCreate
makes some allocations. The first snapshot shows what was allocated, it seems it's related to initialization of random numbers generator:
But if you call UuidCreate
once again, no new allocations are made. The second screenshot shows that no leaks found. So formally there are leaks but you can't fix it, and it's not a big deal - very few memory allocated.