Monte Goulding wrote:

>> On 8 Feb 2017, at 11:02 am, Richard Gaskin wrote:
>>
>> Monte Goulding wrote:
>> > ...You might think we don’t need to touch it but it has
>> > been touched recently because of a change in the way we
>> > retain object references.
>>
>> Now I'm curious: anything interesting there in terms of features,
> performance, or memory handling?
>
> The main advantage is stability.

That's a feature. And a good one. In my community meeting with Peter last week he outlined some of the effort going into v9 stability improvements, and I was quite impressed.

> You might remember that in one of the early 8 releases (not sure
> which one as it was just before I started) the memory management
> of objects changed so they would be released sooner if deleted
> within tight script loops instead of waiting for the next main
> loop to released them. It was a response to a bug where creating
> and deleting lots of objects in a loop bloated memory use I believe.
> Well deleting them earlier resulted in *lots* of instability where
> there were references to objects (say the internal defaultStack
> global for example) but the object had been deleted. Things like
> scripts still executing on objects that are meant to be deleted
> or setting the defaultStack to a stack that has just been deleted.
> Anyway in order to make it easier for us to resolve these issues
> Fraser wrote a class to use as an object handle whenever we want
> to keep a reference to an object. So now we can do stuff like
> t_stack.IsValid() before doing something with t_stack.
>
> For example one crash that I just fixed is this one: https://github.com/livecode/livecode/pull/5143 <https://github.com/livecode/livecode/pull/5143>
>
> In that crash we were getting the stack of an object when it is being
> sent a message then using it later but the particular crashing code
> was deleting the stack the target object was on in a frontScript
> which was executed between getting the reference to the stack and
> using it. So the change now uses an object handle so we can check
> it’s still valid before sending the message after the frontScripts
> are executed ;-)

Sounds like a very good change. Thanks for that background. Even though I almost never write in C anymore, that under-the-hood stuff is very helpful for understanding how the engine works.



>> Thanks for running this by the community.
>
> It’s worth remembering that almost all of what we do is run by the
> community because everyone is free to subscrib to our github feed
> and comment on our PRs.

An excellent reminder. The Github tools have made the process wonderfully visible.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to