Search code examples
iphonememory-leaksanalyzergarbage

Understanding the results of analyzing my application


I have some memory problems, from another post I tried to analyze my project to understand my errors.... here are some things that I don't understand where's my error....

thanks

1: sqlite connection: sqlite connection http://grab.by/grabs/2125d36a8ec1fb0af1c813af33af5653.png

2: json converter: json converter http://grab.by/grabs/7b22080098c8931d7ef505a1eb7c087e.png

3: url connection: url connection http://grab.by/grabs/848a0942f69c91303347d08c64fb2fbb.png

4: cell of uitableview: cell of uitableview http://grab.by/grabs/3917e88829bb6c956bb30445fc7bec20.png


Solution

    1. As stated you're assigning to dbrc without using it. You could just leave out the assignment if you're not going to use the error code.

      sqlite3_prepare_v2(...);
      ...
      while (sqlite3_step(...) == SQLITE_ROW) {
        ...
      
    2. If the for loop above is not run (i.e. the regex fails to match), then matchOk will never be initialized, i.e. it contains garbage.

      NSString* matchOK = nil;
      int nM = 0;
      ...
      
    3. You have +alloced a NSURLConnection but never store the result anywhere, thus to the analyzer there is no chance -releaseing it afterwards. This causes a leak.

    4. You have +alloced a TickerSessions without -releaseing it.

    Actually you could open the Build Results window to see what triggers the error.

    http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/XcodeProjectManagement/art/analyzer_results_by_step.jpg