Hi Sebastian,

I know it is not being GC'd because I use Javascript Memory Validator (a
nice tool), so I can see this widget still on the heap after GC.
I tried it without the ".disconnect", same result.
I tried reusing the same label and just changing the text, but the width
didn't get recalculated.

Thanks for the suggestion to use _computeObjectNeededDimensions as
inspiration for a non-widget implementation - I'll try it.

Cheers,

Peter


On 3/1/07, Sebastian Werner <[EMAIL PROTECTED]> wrote:

What should be disconnect? Are you sure there is no javascript error
because of a missing function (maybe dispose not get executed at all).

Why do you think that it is not garbage collected? To use a widget
just for calculating text is to much overhead. One optimization would
be to use just one label and update the text each time. Dispose just
fix memory leak issues. It does not directly garbage collect them.
This mean dispose does not free your memory directly. It depends on
the browser.

Please take a look at _computeObjectNeededDimensions of the Label
widget implementation. Maybe you can implement your own custom way to
solve this locally - without a widget.

Hope this helps.

Sebastian

PS: BTW: getPreferredBoxWidth is not meant to be used by the user of
the API and is not mentioned in the API browser, too. With further
updates of qooxdoo the usage of such methods may break your code.



Am 28.02.2007 um 23:18 schrieb Peter Helfer:

> I am using this function to calculate the width that a string will
> occupy when displayed:
>
> qx.Class.strDisplayWidth = function (str)
> {
>     var lbl = new qx.ui.basic.Label(str);
>     var width = lbl.getPreferredBoxWidth();
>     lbl.disconnect();
>     lbl.dispose();
>     return width;
> }
>
> The Label never gets garbage-collected. Is there some additional
> function I need to call to make it go away? Or is there a better
> way to compute the screen width of a string?
>
> (I'm using qooxdoo 0.6.1)
>
> Thanks,
>
> Peter
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to