• 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: Memory Leak while using NSTask repeatedly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Leak while using NSTask repeatedly


  • Subject: Re: Memory Leak while using NSTask repeatedly
  • From: Chris Ridd <email@hidden>
  • Date: Thu, 16 Oct 2003 19:25:37 +0100

On 16/10/03 5:42 pm, Huyler, Christopher M <email@hidden>
wrote:
> Is there some more clean-up that I am missing?

The autorelease pool is filling up with more and more copies of your
arguments, and you are not clearing the pool.

So there probably isn't a leak.

If you create a new pool at the start of the loop and release it at the end
(by the sleep()) your memory usage should stablize.

BTW: polling for your process is "tacky", in that it uses unnecessary CPU.
If there's another way to do it...

Also if you're just trying to test for the existence of a process which you
know the pid for, try calling kill(pid, 0). That will succeed if the process
is there, and fail if it isn't. That will be *much* cheaper than calling ps
repeatedly :-)

Read 'man 2 kill' for the details.

Cheers,

Chris
_______________________________________________
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: 
 >Memory Leak while using NSTask repeatedly (From: "Huyler, Christopher M" <email@hidden>)

  • Prev by Date: Re: No Result Obtained When WebServices Is Called From A Cocoa Client [uses WSMakeStubs]
  • Next by Date: Re: Restraining window movement + gridding
  • Previous by thread: Memory Leak while using NSTask repeatedly
  • Next by thread: Re: Memory Leak while using NSTask repeatedly
  • Index(es):
    • Date
    • Thread