0
votes

How does Instruments access the memory allocation information in a running iOS app? I would like to write code that could monitor allocations created and destroyed by a class. Then, unit tests could be written to prevent memory leaks. Even if only a basic memory usage number is available, the unit test could read the number, create and destroy the target object, then read the number again and report problems.

1

1 Answers

1
votes

class_getInstanceSize() can give you instance size of your objects. You can write macros around your code to get the total size required by them, but it's a good start.