Garbage collection in JavaScript is browser-dependent, but similar rules apply as with Java. When you are no longer using the data, make sure you eliminate all references to it. For example, if you've stored it in an Array or Collection of some sort, be sure to null out or remove those entries. The browser's JavaScript engine will do it's best to garbage collect that data (some better than others obviously).
GWT goes to great lengths to do this for you as automatically as possible. For example, if you perform an AJAX request for a chunk of HTML and insert it into an HTML widget, insert it into the page, then later remove it, GWT ensures that the element is cleanly detached from the DOM and the Widget object is removed from it's parent. Assuming you haven't stored it elsewhere (usually not), it will be eligable for garbage collection. Others can probably tell you which browsers to watch out for (IE6?), and some pitfalls that might cause problems (circular references?) On Apr 23, 6:41 am, "[email protected]" <[email protected]> wrote: > I have GWT application. Use loads page, then visits links (I use GWT's > Hyperlink, so page is not reloaded). Amount of data that page contain > is increased (I use AJAX requests to get data from server). I have > some data that shouldn't necessarily exist always, I can load it from > server again. Is there any way I can tell js engine that it can be > garbage collected? Something similar to java.lang.ref.SoftReference? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
