tags:

views:

1295

answers:

9

Hi,

I have done xml parsing same as SeismicXML example. But now it gives me memory leak problem.

When i tested SeismicXML with instruments, it also give same memory leak.

In SeismicXML, EarthQuake example is there, it contains all the string and array which come from xml parsing. SO 'Leak' instruments showing all this string and array as leaked objects.

I spent lot time behind this issue. but i couldn't solve yet. If anybody has solve this issue then pls share your review with me.

Thanks, Haresh.

A: 

SeismicXML has a few bugs in it but I'm not aware of a leak. Can you post more detail?

Roger Nolan
A: 

Hi,

Thanks for giving me reply.

Ok i m giving u image of leaked objects.... First one is NSString and then NSMatchPort and CFRunLoop as a leaked objects. AS i mentioned above,  i m using EarthQuake object which holds all strings and array coming from xml parsing. 

I have lastName string property in this class it also as leaked object.

"http://img514.imageshack.us/img514/874/erroras3.png"

For NSMatchPort and CFrunLoop  "http://img25.imageshack.us/img25/9462/nsmatchportvr7.png"

For CfRunLoopSouirce "http://img25.imageshack.us/img25/3000/cgrunloopyd9.png"

 Please look at this and tell me if u know something.

Thanks.

A: 

Hi,

These are leaked objects description.....

Thanks.

A: 

You may want to download, install and use the CLANG checker tool to understand why your code is leaking memory. This tool (which is already built for Leopard 10.5.x) may sometimes fail to provide the correct answer, but in my personal experience it never failed. I highly recommend it as one of your daily development tools.

You can download it from

http://clang.llvm.org/StaticAnalysis.html

Usage it really simple. Take a look at

http://clang.llvm.org/StaticAnalysisUsage.html#BasicUsage

In practice, you simply build your Xcode project using the command

scan-build -k -V xcodebuild

then, you inspect the resulting output HTML files using the command that will appears as output in your terminal window. These files will give you a detailed explanation of why something is wrong in your code (not just memory leaks).

Kind regards

unforgiven
A: 

Ya thanks yar

.... i downloaded this tool but i don't know how to use, i tried from usage but its not working. and how it will connect with my project and how can i use in project.pls give me some more details

A: 

ok,

I am supposing you correctly installed the tool so that you can invoke it from a terminal.

To use it:

1) cd /your/project/path 2) scan-build -k -V xcodebuild

if this does not work then you have not installed the tool correctly: at least you do not have your "path" correctly set.

Here is how to set the path for c or tcsh shell , asuming you installed the tool in /opt/checker-0.160

set mypath=(/opt/checker-0.160) set path=($mypath $path)

3) if the command works correctly, it build your project and starts a web server on your machine. It then gives you the url where you can connect to on your machine to read the results.

If the command is not able to start a web server, it will anyway tell you that the html files are available in a specific directory and you will be given the path. Usually this directory is to be found under /tmp.

Simply go to this directory

cd /path/to/results/directory

and then

open index.html

You will see the full report. Best Regards.

unforgiven
A: 

Thanks yar,

      I was using without installation of this tool. Now i tried to install this package, but it ask for password and i haven't set any password....do u any password like that.
A: 

Before I initialize my NSXMLParser I set the following:

[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:URL];

This stops leaking.

Colins
A: 

I think this question has been answered here: http://stackoverflow.com/questions/1598928/nsxmlparser-leaking

sani212