[Development] Qt 5.9's new garbage collector documentation? + root_ptr
Thiago Macieira
thiago.macieira at intel.com
Thu Jul 6 02:25:33 CEST 2017
On quarta-feira, 5 de julho de 2017 15:31:28 PDT Phil Bouchard wrote:
> For example in HTML we could have 1 root_ptr for each HTML page and when
> this page is destroyed then the root_ptr guarantees all associated nodes
> will be destructed as well. When I refer to a node I mean the
> representation of an atomic variable or a function in Javascript which
> is pointed to by a reference counted pointer. So you can have all the
> mess you want in Javascript, when the page is destroyed then all memory
> associated to that page is freed.
>
> It's the same thing with QML and its windows. When a window is
> destroyed then all associated variables will vanish as well, cyclic or
> not. From my experience, the only way a window can return a value is
> either by sending a signal with its parameters passed by value or by
> storing them in some local database. But the parent shouldn't have any
> pointer connection of QML / Javascript type with its child window
> (downstream) otherwise it's bad programming. Ex.:
What's the advantage compared to the current model where the GC runs
periodically and frees unused objects before the window is closed?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list