Re: Hungry app
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