property DataItemClass : class "DataItem"
script MemoryLimitBug4AppDelegate
property parent : class "NSObject"
on applicationDidFinishLaunching_(aNotification)
try
-- TRUE - Runs to completion in .1 seconds, app taking 18MB of real memory
-- FALSE - Runs to completion in .5 seconds, app taking 18MB of real memory
set limit to 500
-- TRUE - Runs to completion in 3 seconds, app taking 19MB of real memory
-- FALSE - Quickly goes up to 1.1GB real memory and keeps trying for more, must kill to terminate
-- set limit to 10000
if true then
log "creating " & limit & " objects without setting string"
repeat with i from 1 to limit
set anotherObj to DataItemClass's alloc()'s init()
end repeat
else
log "creating " & limit & " objects setting string"
repeat with i from 1 to limit
set anotherObj to DataItemClass's alloc()'s init()
anotherObj's setString_(i as string)
end repeat
end if
log "DONE"
on error errMsg number errorNumber
log "on error: " & errMsg & ": " & errorNumber
end try
end applicationDidFinishLaunching_
on applicationShouldTerminate_(sender)
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
script DataItem
property parent : class "NSObject"
property aString : missing value
on setString_(theString)
set my aString to theString as string
end setString_
end script
____________________________________