History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5127
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P0 P0
Assignee: André Bargull
Reporter: Antun Karlovac
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Memory leak in window

Created: 16/Nov/07 05:47 PM   Updated: 29/Nov/07 03:02 PM
Component/s: Components - base
Affects Version/s: 4.0.6/Jujube
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

File Attachments: 1. File LPP-5127.lzx (0.2 kb)


Severity: Major
Fixed in Change#: 7,417
Fixed in branch: trunk
Runtime: N/A
Flags: Regression
Fix in hand: False


 Description  « Hide
We've discovered a memory leak in basewindow. Windows create a windowlist on-the-fly to keep track of which window should be frontmost. That means that every time a window is created there's a reference created (which would stop it being garbage-collected).

Here's the bit of code:
        <method name="init">
            // Windows that are datamappped control their own visibility
            if (this.datapath != null) {
                this.datapath.setAttribute('datacontrolsvisibility',
                    this.visibility == "collapse");
            }

            super.init();
            this.mousedown_del = new LzDelegate ( this, "_mousedown", this , "onmousedown" );
            this.mouseup_del = new LzDelegate ( this, "_mouseup", this , "onmouseup" );

            if (this.visible) {
                var wlist = parent.options['windowlist'];
                wlist.push(this); // frontmost window for now
                this.setAttribute('haswindowfocus', true);
            }
        </method>

The destroy method should clear out the references in windowlist:

        <!--- @keywords private -->
        <method name="destroy">
          <!-- TODO: [2005-04-07 ptw] remove when cleanup is automatic -->
          if (this.mousedel) {
              this.mousedel.unregisterAll();
          }
          super.destroy();
        </method>


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
André Bargull - 19/Nov/07 01:41 PM
This is a regression, introduced by the new "visibility" stuff:

In old days, we were calling "setVisible(false)" in "LzView#destroy(..)", now it is "setVisibility( "hidden" )".
Therefore "basewindow#setVisible(..)" isn't called, which would have removed the basewindow from the windowlist-array.

André Bargull - 20/Nov/07 03:39 PM
as by conversation on laszlo-dev, "LzView#destroy(..)" will be reverted to call "setVisible(false)"...

André Bargull - 28/Nov/07 02:52 PM
attached testcase

André Bargull - 29/Nov/07 03:02 PM
------------------------------------------------------------------------
r7417 | bargull | 2007-11-30 00:01:05 +0100 (Fri, 30 Nov 2007) | 26 lines
Ge?\195?\164nderte Pfade:
   M /openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs

Change 20071128-bargull-4 by bargull@dell--p4--2-53 on 2007-11-28 23:49:42
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: revert setVisibility("hidden") call in LzView#destroy(..)

New Features:

Bugs Fixed: LPP-5127 "Memory leak in window"

Technical Reviewer: ptw
QA Reviewer: hminsky
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
As already discussed on laszlo-dev, we're reverting the call to setVisibility("hidden") and we'll use again setVisible(false), so that basew
indow won't leak memory anymore.


Tests:
see bugreport


------------------------------------------------------------------------