Some thoughts about the ObjectRegistry, now that this is the last source 
of memory leaks (at least in my small examples):
As a reminder: maps written like the following: 
registry[hash] = obj

with an ever-changing hash-value leak at least on IE7, even after correct 
deletion of key/value pairs.
(Note that there are other places than the ObjectRegistry using such 
hash-map constructs as well - but most of them could be replaced with an 
Array.push/pop() )


I think that there are two approaches to fix this:

1) Reuse hashes. After object-disposal no object should be bothered if the 
hash-key is reused again. If instances still hold hash-keys after object 
disposal and make use of them, than it's a bug, that needs to be fixed. 
These parts would fail somewhen also without a change.

Caching freed hashes is a no-brainer in the Object-Registry
--- ObjectRegistry.register ----
      hash = obj.$$hash = this.__freeHashes.pop();
      if (!hash) {
        hash = obj.$$hash = (this.__nextHash++).toString(36);
      }
------------------
Of course you need 2 other lines - one for the declaration of __freehashes 
and one for filling it on unregistering objects.

The nice thing about this approach is, that it indirectly fixes all other 
parts in the code where hash-maps are used as well.
And indeed - with this change (and the ones in the post yesterday) I can 
create and destroy 20.000 Labels (as always in blocks of 500 'concurrent' 
Labels) without any leak.

OK - say it leaks less than 0,2MB, it can't be measured too exactly when 
its that low.
And to be pedantic - actually this doesn't fix the leak, it just limits it 
to the maximum number of concurrent living objects. 

2) Write your own complete HashMap-implementation without leaks.
Seems to be too much work now before the API freeze.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to