• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Testing for Memory Leaks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing for Memory Leaks


  • Subject: Re: Testing for Memory Leaks
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 11 Nov 2002 19:22:05 +0100

In previous OS (non-mac) I have had access to a variety of calls where I could query the amount of available memory. I just query at the start of my program and before termination, then compare the values and report an error if they don't match.

Is there such a mechanism to test Cocoa applications written with Objective C on Mac OS X 10.2 (Jaguar)?

No. What it would be good for? Any module can make and keep caches, and many actually do: such a comparation would give a completely useless information that indeed there is some memory allocated and not freed. Nevertheless if you do need a very rough check whether the memory occupation rises or not, just use plain ole 'ps -o vsize'.

There's a very simple way of checking for your own objects whether they leak or no by storing their IDs in -init..., removing it in -dealloc, and checking whenever you want to how many of them -- and which ones -- stil exist. For majority of cases this should be sufficient (or at least, it proved to be for me).

For more sophisticated snooping you can use either the standard tools (namely, ObjectAlloc and perhaps MallocDebug), or the stuff of Omni, which is said to be pretty good.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Testing for Memory Leaks (From: Dan Wood <email@hidden>)

  • Prev by Date: Re: drawers closes, but is visible
  • Next by Date: Mystery threads eating CPU cycles
  • Previous by thread: Re: Testing for Memory Leaks
  • Next by thread: Re: drawers closes, but is visible
  • Index(es):
    • Date
    • Thread