• 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: Hungry app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hungry app


  • Subject: Re: Hungry app
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 04 Jan 2013 10:48:16 +1100

On 04/01/2013, at 9:22 AM, Axel Luttgens <email@hidden> wrote:

> This part of your script seems to yield memory leaks here, for about 0.5 Mb per iteration:
>
> 	on idle
> 		doIt()
> 		return 1
> 	end idle
>
> 	on doIt()
> 		local psParas, processNames
> 		set processNames to {}
> 		set psParas to paragraphs of (do shell script "ps uxc")
> 		repeat with aPara in psParas
> 			set end of processNames to last word of aPara
> 		end repeat
> 	end doIt
>
> Something must be broken somewhere...

The use of "last word" seems problematic. Rather than build a list like that, it might be worth trying something simpler:

	set psParas to paragraphs of (do shell script "ps uxc")
	considering case
		repeat with aPara in psParas
			if aPara ends with " mongod" then
				-- do stuff
			else if aPara ends with " node" then
				-- do stuff
			else if aPara ends with " Terminal" then
				-- do stuff
			end if
		end repeat
	end considering

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Hungry app
      • From: Axel Luttgens <email@hidden>
References: 
 >Hungry app (From: Jörgen Stahle <email@hidden>)
 >Re: Hungry app (From: Jörgen Stahle <email@hidden>)
 >Re: Hungry app (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Hungry app
  • Next by Date: Re: Hungry app
  • Previous by thread: Re: Hungry app
  • Next by thread: Re: Hungry app
  • Index(es):
    • Date
    • Thread