Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
Hi,
Do anyone know , in Leak Instrument, what does #Net, #Overall, and #Net/#Overall represents .
I had a problem with these, as after running for some time , the histogram of #Net/#Overall turns to red and My application closes(crashes) later.

No Memory leaks were found.

If anyone know the technicalities about these , then please help.

Thank u.:(
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
overall # is the number of objects of that type created
overall bytes is the total of bytes taken up by those objects

net # is the number of objects still living of that type
net bytes is the total bytes still taken up by those objects

The chart on the right shows what percentage of overall objects are still alive. if you allocated 10 strings and freed 5, you'll see:

overall #10, net #5, graph will be at 50%.

If your program is allocating and freeing memory at about the same rate, then over time overall will go up, and net will stay about the same. (That is, it will go up when you load a record/image/web page, but should go down when you unload it.)

What you're seeing - the graph goes all red- shows that you're allocating memory somewhere and never freeing it. You can click next to the name of the object type to drill down, and see where they're being allocated and not freed.
 

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
I tried your suggestion. What I found is the CFNumber Object name graph is red totally from the starting of my application. No memory leak was showing my applicaiton.
I tried with simple code. following is,

- (void)applicationDidFinishLaunching:(UIApplication *)application {
gTimer=[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:mad:selector(startConnection1:) userInfo:nil repeats:YES];

[window makeKeyAndVisible];

}


-(id)startConnection1:(NSTimer*)timer
{
NSString *test=[[NSString alloc]initWithCString:"welcome"];
NSLog(test);
[test release];
return self;
}

The following codes histogram in the Leak Instrument is also turning to red.
One more thing i observed is the CFNumber Object is red from the starting of my application.

Any suggestion.

Thank you..:(
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
I tried your suggestion. What I found is the CFNumber Object name graph is red totally from the starting of my application. No memory leak was showing my applicaiton.
I tried with simple code. following is,

I don't see any CFNumber objects in the code you posted - but if you put your mouse over "CFNumber" and click the gray arrow after the name, you'll see a list of your CFNumber objects. If you click some of the objects, you'll see a list of the operations for that memory location. At the bottom of that list, you'll see where you're allocaiton that object and never releasing it.
 

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
I don't see any CFNumber objects in the code you posted - but if you put your mouse over "CFNumber" and click the gray arrow after the name, you'll see a list of your CFNumber objects. If you click some of the objects, you'll see a list of the operations for that memory location. At the bottom of that list, you'll see where you're allocaiton that object and never releasing it.

hey I found them exactly as you said..

but, all those allocations are not refered to my application code, I mean these all are refferred to "UIKit and Foundation classes...."

I am not getting the actual issue behind this..

Any clue.
 

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
#Allocations

Hi,

My application contains, the timer calling http, parsing and the clearing screen to display the updated contents. My application is running OK without memory leaks when tested with Leaks instrument. It doesnot contain any memory leaks. But the #Allocation column in the Leak instrument is turning from BLUE to Pink and then red after the application gets executed for 15min. around.
Also the #Overall allocation values keeps on growing increasing.

After 15min of running the application , it gets crashed.

I would like to know if anyone had faced this issue before. If so , can u provide the solution.

Thank u.
 

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
Object alloc/#Net

I don't see any CFNumber objects in the code you posted - but if you put your mouse over "CFNumber" and click the gray arrow after the name, you'll see a list of your CFNumber objects. If you click some of the objects, you'll see a list of the operations for that memory location. At the bottom of that list, you'll see where you're allocaiton that object and never releasing it.

I had a problem with these, as after running for some time , the histogram of #Net/#Overall turns to red and My application closes(crashes) later.

#Overall is getting increased every time.
#Net flickers with different screens on active.

No Memory leaks were found. Following the structure what do I follow for displaying the updates..


In my app I have to retrieve the xml content containing both text and image links from the remote server using http connection, and I have to update the content for every 25-30 secs.

For this I have followed the following way..

1) Retrieved the xml content asynchronously using NSURLConnection and parsed using NSXMLParser.

2) After Parsing the content , I am adding the view controller for the respective xml content to the window of the app as subview and the view controller again contaings differnt subview such as UILabel ,UIView and UIIMageview to display images. Images are displayed by retrieving from another http connection after parsing the xml content.and caching the content in NSMutableDictionary.

3) Also in viewdidload I am placing the NSTimer for 30 sec to call the http connection for the xml related to the screen.

4) After retrieving the xml for the screen which was already active on the window, In enddocument callback of NSXmlParser, I am calling the ViewDidLoad of the viewcontroller, where I remove all the subviews from the super views of the ViewController to clear the screen and again display the content by adding subview.

5)My application works fine on the simulator, though I have to test it yet on the actual device yet.
 

Darkroom

Guest
Dec 15, 2006
2,445
0
Montréal, Canada
Don't forget to also test your app with Instruments on device instead of just on the simulator. I had some wild results concerning CA and CG with instruments using the simulator while those strange results didn't show up on device.
 

mpramodjain

macrumors regular
Original poster
Nov 20, 2008
152
0
Banglore
Don't forget to also test your app with Instruments on device instead of just on the simulator. I had some wild results concerning CA and CG with instruments using the simulator while those strange results didn't show up on device.

Hi,
Thanx for the reply.
I would like to know, any more improvements can be done in my application architecture or whether any loop hole exists that may occur as problematic on the device.
 

Darkroom

Guest
Dec 15, 2006
2,445
0
Montréal, Canada
in my experience, CGPoint continuously added 0 bytes to the net object allocations in the simulator (the red bar maxed and never recovered), but it didn't on device. there are certainly bugs with instruments using the simulator, and perhaps too on device, but i'd suggest only using the simulator for visual testing.

now that i think about it, it is kinda strange that apple even allows use of instruments on the simulator to begin with.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.