swiftxcodedebuggingdynamic-memory-allocation

Why in Xcode debugger and instruments some memory is just "malloc(48 bytes)"


This, but meanwhile, other objects have fully qualified ObjectiveC class names, Swift class names, etc.

Why are some allocations written as "malloc(48 bytes)", while others aren't? Does this have anything to do with C raw code, and C++ close that is running, which doesn't provide this advanced data about the specific types of objects? Actually, how is this info about the specific types of allocated objects is even provided?


Solution

  • This is probably due to them being allocated using low level functions like malloc (in either C or C++). In Xcode some allocations are labeled as malloc(48 bytes) because they don't have the metadata necessary be identified as specific types in the debugger. There is no type information provided in these functions. Those made in Obj-C or Swift do, as the debugger is built for them.