Results of property accessing or commands performed on
objects that are not
assigned to variables are not being released.
This leads to a memory leak, if the result is something else
integer, float (not double) or symbol.
To replicate the issue, attach the following script to any
sprite, click on
it, and check the memory usage increasing:
on exitFrame me
go to the frame
on beginSprite me -- create a +50MB string.
repeat while s.length<50*1024*1024
on mouseUp me
s.char[1..s.length] -- get all chars of the string.
put result() -- the result should be stored here, but it is
Alternatively, with Xtrema [
http://xtrema.rtr.gr ] you can
check from the message window:
s=_s().resize(50*1024*1024, "abcd").string -- generate a 50
s.char[1..s.length] -- using this command results to the
The above code should never be found in a real world app
-since it just
returns a value and performs no modifications- but it was the
to demonstrate the leak.
Commands on objects that do perform modifications and also
will lead to memory leaks, if the result is not assigned to a
Checked on XP 8.5 & MX2004 and on OSX 10.3 MX2004
Tech: Dev Team Note, based on XDK.
The resultValue of the getProp and especially the resultValue
of the callptr
of the callHandler calls should be assigned to the global
result value, if
no value to receive the result has been used in the lingo