views:

257

answers:

1

I tested my app in Instruments. No leaks found, but app crashes (not immediately - after ~20 minutes [depends on user's activity] of working). I viewed Allocations. It reports:

Category | Live Bytes | Count Live | # Living | # Transitory | Overall Bytes | # Allocations (Net / Overall)
Malloc 16 Bytes | 235088 | 14693 | 0 | 235088 | 14693 | 1.00

All records (when I view detailed info for "Malloc 16 Bytes") are made for only one object:

# | Object Address | Category | Creation Time | Live | Size | Responsible Library | Responsible Caller
0 | 0x104b50 | 817461248 | • | dyld | _dyld_start

(...and 14693 records with same fields data, except, of course, #).

Stack Trace:

   0 CoreFoundation __CFAllocatorSystemAllocate
   1 CoreFoundation CFAllocatorAllocate
   2 CoreFoundation __CFGetConverter
   3 CoreFoundation CFStringEncodingGetConverter
   4 CoreFoundation CFStringGetSystemEncoding
   5 CoreFoundation __CFStringInitializeSystemEncoding
   6 CoreFoundation __CFInitialize
   7 dyld ImageLoaderMachO::doImageInit(ImageLoader::LinkContext const&)
   8 dyld ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&)
   9 dyld ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&)
  10 dyld ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&)
  11 dyld ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&)
  12 dyld dyld::initializeMainExecutable()
  13 dyld dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**)
  14 dyld dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*)
  15 dyld _dyld_start

I can't paste all code here (app is not a few lines). But, please, give me some advice - where to search for memory leak or smth. else...

+1  A: 

IMHO, your number one priority is to let your application run. Try to locate where the problem is, by commenting part of your code; if the app doesn't crash anymore, then the problem is located within the part you just commented, if it still crashes, then it must be somewhere else. Repeat the steps until you fix the bug.

After you get your app run, then you can start to find its leak or improve performance.

shader
Hmm, the problem is that app crashes only after ~20 min of working.
kpower
Seems to me that there is not a specific part of code that crashes, but the system is running out of memory after ~20 minutes. So there could either be a lot of memory leaks, or the app is just too taxing on the RAM.
Rengers