#define BOOST_TEST_MODULE MemoryLeakTest
#include <boost/test/unit_test.hpp>
#include <iostream>
using namespace std;
BOOST_AUTO_TEST_CASE( MemoryLeakTest)
{
double* n1 = new double(100);
void* v1 = n1;
cout << sizeof(v1) << endl;
delete v1;
}
This code will work perfectly fine without any error leaks. But I would like to be able to get the size of the object void*
is holding on to.I would imagine there is a way because the delete statement knew how large the object v1 was pointing to so that it can delete it so it must be stored some where.