Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 07-15-2009, 04:18 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 109
raheel is on a distinguished road
Default Figuring out instrument leaks! so many!!!

This morning is scary. I Started instruments for the first time to toast the completion of my project... only to find soooo mannny leaks! its incredible!

And after watching those things fill up the table. I am now clueless as to what they mean!. Could anyone please explain!

The leaks are coming in when I'm scrolling the tableview. with about 200 cells.
And when I call the InitialiseDatabase method in appdelegate, Many many many more leaks of NSCFString.

And, i'm sure your familiar with SQLiteBooks app from Apple. They have a method called InitialiseDatabase. That is called in ApplicationDidFinishLaunching.

My app calls this method InitialiseDatabase first on touching a UIButton. Then After certain selections in PickerView, my app recals this method again with different sql query string.
This is where i get many many more leaks. On "ReCalling" initialiseDatabase;
My goal was to kinda sort listing and display data on the very same tableview. and reload it! and initialise database empties the array and reloads it with new objects.

Any clues/suggetions/directions would be great!
Attached Images
File Type: jpg sdleaks1.jpg (66.4 KB, 0 views)
File Type: jpg sdleaks2.jpg (56.8 KB, 0 views)
raheel is offline   Reply With Quote
Old 07-15-2009, 01:05 PM   #2 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

The first time you check it can be a mess - especially because if you leak an array full of strings, you'll see the array and the 99 strings in the list. So start by looking for arrays and your custom classes in the list - if you clean those up, some of the numbers and strings will disappear from the list.

Click the "details" button at the bottom of the leaks window - that will open up a pane on the right that shows the stack track for that object. That trace will tell you where the object was created, which should help you figure out why it was leaked. You can double-click a frame in that trace to see the exact line where the object was created.

Remember that a "leak" means that you created an object and it was never released properly. The leaks tool knows that it's a leak when you no longer have any pointers to the object; there's no possible way you could release it then. So for each object created in your suspect method, ask yourself "when does this get released?"
__________________

Free Games!
smasher is offline   Reply With Quote
Old 07-16-2009, 10:49 PM   #3 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 905
TunaNugget is on a distinguished road
Default

Here's a good tutorial. You'll also sometimes get a memory leak from the frameworks. I keep getting one in AVAudioPlayer.
TunaNugget is offline   Reply With Quote
Reply

Bookmarks

Tags
leaks, tableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 380
10 members and 370 guests
apatsufas, comicool, dansparrow, husthlj, LegionMD, LunarMoon, mer10, Murphy, padsoftware, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,677
Threads: 94,127
Posts: 402,916
Top Poster: BrianSlick (7,990)
Welcome to our newest member, husthlj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0