Game Development Reference
In-Depth Information
PrintAllocations();
Simple* pSimple2 = new Simple();
PrintAllocations();
Simple* pSimple3 = new Simple();
PrintAllocations();
delete pSimple2;
pSimple2 = nullptr;
PrintAllocations();
pSimple2 = new Simple();
PrintAllocations();
delete pSimple2;
pSimple2 = nullptr;
PrintAllocations();
delete pSimple3;
pSimple3 = nullptr;
PrintAllocations();
delete pSimple1;
pSimple1 = nullptr;
PrintAllocations();
return 0;
}
This is a very simple function. It begins by using the memset function to initialize the first 12 bytes of
the memory heap. memset works by taking an address, then a value to use, then the number of bytes
to set. Each byte is then set to the value of the byte passed as the second parameter. In our case we
are setting the first 12 bytes of pMemoryHeap to 0 .
We then have our first call to PrintAllocations and the output from my run is the following.
0x00870320
0x00000000
0x00000000
0
Search WWH ::




Custom Search