Jigar
Jigar

Reputation: 21

check memory leaks of c code in xcode

I am writing an iPhone App which contains part of C,C++ code. I allocate memory using malloc() and calloc().

How can i check memory leaks in this part of code using Xcode profile.

Can anyone please help.

Thanks in advance.

Upvotes: 1

Views: 3366

Answers (3)

rishi
rishi

Reputation: 11839

You can use Leaks and Static memory analyser to detect leak/static memory loopholes in code with Xcode.

Leaks - http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html

Static memory analyser - http://developer.apple.com/library/mac/#featuredarticles/StaticAnalysis/index.html

Upvotes: 1

trojanfoe
trojanfoe

Reputation: 122381

You can use Instruments to find the leaks using the Leaks profile.

Here's a tutorial by Ray Wenderlich.

Upvotes: 0

Aneesh Narayanan
Aneesh Narayanan

Reputation: 3434

Please make sure that the allocated memory is deallocated using the free() method.

After using "malloc and calloc" to allocate memory is important for freeing up the allocated memory when finished with it.

Upvotes: 0

Related Questions