We hook the memory related APIs with ourselves' functions, like below:
if ((malloc_get_all_zones(0, nullptr, reinterpret_cast<vm_address_t**>(&allZones), &numZones) == KERN_SUCCESS) && (numZones > 0) && (numZones > 0))
{
if (allZones[0] == nullptr )
{
return false;
}
trackZone = allZones[0]
trackZone->malloc = &my_malloc;
trackZone->calloc = &my_calloc;
trackZone->valloc = &my_valloc;
trackZone->memalign = &my_memalign;
trackZone->free = &my_free;
trackZone->free_definite_size = &my_free_definite_size;
trackZone->try_free_default = &my_try_free_default;
trackZone->realloc = &scf_realloc;
}
our functions are called when allocate memory with XCode15+MacOS14.6, but when we upgrade the compiling env to XCode16+MacOS15, it won't work any more.
Post
Replies
Boosts
Views
Activity
To reduce the app size, the application dmg file does not contains the symbols in it. But when we meet memory issue, I use
"leaks 'appName' --outputGrap =memoryLeak.memgraph" to get a memory graph
Because there is no symbols contained the application, there is no function names(module names) which allocate the memory from the memory graph.
But, we save the symbols as separate .dSYM files when compile, Is there any way to use the .dSYM files to symbolize the memory graph in this case ?