Hi
I have a simple app (below) that assures that a web server is running. (For one command I'm using Teminal.app since, for some reason, it doesn't work if I use an ordinary "do shell script"-command there). At startup, the app also assures that the app itself is a login item.
Now, this simple app seems to eat a lot of virtual memory! Virtual memory for this simple app is growing conutiously, reaching above one GB after a few days!
I have a couple of other – huge – applescript applications running on servers, and I would not be surprised if one of them where eating memory - but that is not the case. More surprisingly, this small one is very hungry…
(Im running it on a Mac Mini 2,4GHZ core2 duo, with OS X 10.8.2 and 6 GB RAM)
Any suggestions?
Here is all the code:
property dbLogPath : "~/WebServer/baristaciao_db.log"
property prefsDomain : "se.tt.ciaobarista"
property myNameKey : "myPrettyName"
on run
my startWeb()
global myPath, gMyPosixPath, gMyName
tell application "System Events"
set myPath to (path to me)
set gMyPosixPath to POSIX path of myPath
set gMyName to (name of myPath)
set AppleScript's text item delimiters to "."
set gMyName to first text item of gMyName
set AppleScript's text item delimiters to ""
end tell
my assureMeLoginItem()
do shell script "defaults write " & prefsDomain & space & myNameKey & space & the quoted form of gMyName
end run
on assureMeLoginItem()
-- Add as login item if not there:
tell application "System Events"
if (login item (my gMyName) exists) is false then make new login item at end of login items with properties {path:my gMyPosixPath, hidden:true, kind:application, name:my gMyName}
end tell
end assureMeLoginItem
on idle
my startWeb()
return 60
end idle