alias and memory leak
alias and memory leak
- Subject: alias and memory leak
- From: Victor Yee <email@hidden>
- Date: Sat, 17 Feb 2001 13:46:33 -0500
I asked before if resolving aliases could lead to a memory leak. With a little testing, I've refined the question to: does failing to resolve an alias lead to a memory leak? Well... it does on my computer :-(
Here are my two test scripts saved as stay-open applets. I'm using Peek-a-Boo to watch free memory. Be sure to quit the first applet before it hits zero, otherwise, it may fail to respond and require a force-quit:
property x : "nullDisk:nullFile" -- this path intentionally does not exist
on idle
leakMe()
return 2
end idle
on leakMe()
repeat 20 times
nameAvailable(x)
end repeat
end leakMe
on nameAvailable(thisPathStr)
try
alias thisPathStr
return false
on error
return true
end try
end nameAvailable
property x : "nullDisk:nullFile"
on idle
leakMe()
return 2
end idle
on leakMe()
repeat 20 times
nameAvailable(x)
end repeat
end leakMe
on nameAvailable(thisPathStr)
tell application "Finder" to return not (exists item thisPathStr)
end nameAvailable
--
Victor