|
|
@ -2869,8 +2869,7 @@ static int heap_take_snapshot()
|
|
|
|
|
|
|
|
|
|
|
|
for (auto i : entries)
|
|
|
|
for (auto i : entries)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uintptr_t val = 0;
|
|
|
|
uintptr_t val = reinterpret_cast<uintptr_t>(i.first);
|
|
|
|
memcpy(&val, &i.first, sizeof(void*));
|
|
|
|
|
|
|
|
snapshot[val] = i.second;
|
|
|
|
snapshot[val] = i.second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2890,14 +2889,6 @@ static int heap_take_snapshot()
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void* address_to_pointer(uintptr_t ptr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
void* as_ptr = nullptr;
|
|
|
|
|
|
|
|
memcpy((void*)&as_ptr, &ptr, sizeof(uintptr_t));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return as_ptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//this function probably should not allocate. Then again we're shimming through lua which.... probably does
|
|
|
|
//this function probably should not allocate. Then again we're shimming through lua which.... probably does
|
|
|
|
static int get_heap_state()
|
|
|
|
static int get_heap_state()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2981,7 +2972,7 @@ static uintptr_t get_root_address_of_heap_object(uintptr_t ptr)
|
|
|
|
static int msize_address(uintptr_t ptr)
|
|
|
|
static int msize_address(uintptr_t ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
#ifdef _WIN32
|
|
|
|
void* vptr = address_to_pointer(ptr);
|
|
|
|
void* vptr = reinterpret_cast<void*>(ptr);
|
|
|
|
|
|
|
|
|
|
|
|
if (vptr)
|
|
|
|
if (vptr)
|
|
|
|
return _msize(vptr);
|
|
|
|
return _msize(vptr);
|
|
|
|