Results 1 to 8 of 8

Thread: [solved] Modal Window Memory Leak?

  1. #1

    Default [solved] Modal Window Memory Leak?

    Hi. I have this piece of code causing me a lot of trouble with IE7. It produces 5MB of memory leak every time used.

    Code:
    previewImage: function(path) {
            Ext.rt.Application.Loader.onFormActionStart();
            
            if (!this.imagePreviewPreload)
                delete this.imagePreviewPreload;
            
            this.imagePreviewPreload = new Image();        
            this.imagePreviewPreload.src = path;
            
            if (this.imagePreviewPreload.width==0||this.imagePreviewPreload.height==0) {
                setTimeout("Ext.getCmp('"+this.id+"').previewImage('"+path+"')", 250);
                return;
            }
            
            if (this.imagePreviewWindow) {
                delete this.imagePreviewWindow;                    
            }
            if (this.imagePreviewBox) {            
                delete this.imagePreviewBox;
            }
            
            this.imagePreviewBox = {                
                    xtype : 'box',            
                    id: Math.random(),
                    autoDestroy: true,
                    autoEl : {
                        tag : 'img',        
                        id: 'room-image-full',
                        qtip : '#{portal.room_image_qtip}',
                        src : path,                            
                        valign: 'bottom',
                        style: 'border: 1px solid #AAAAAA; padding: 5px;cursor:pointer;'
                    }        
            };
            
            this.imagePreviewWindow = new Ext.Window({
                id: Math.random(),
                layout: 'fit',
                width:    this.imagePreviewPreload.width,
                height:    this.imagePreviewPreload.height,
                modal:     true,
                resizable: false,
                draggable: false,            
                autoDestroy: true,
                items : [this.imagePreviewBox]            
            });
                            
            
            Ext.rt.Application.Loader.onFormActionEnd();
            this.imagePreviewWindow.show();
            this.imagePreviewWindow.getEl().fadeIn();        
        },
    Its basically showing a modal window with a image preview eating 5 MB of RAM. Anyway its not just this. If using Sakis fileupload as a window i get the same problem (if window is modal).

    Any hints here?

    P.S.: FF3 is just fine.

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    *Leak or *usage!? I'm constantly amazed how folks are using the term memory LEAK when it ends up being memory USAGE.

  3. #3

    Default

    LEAK!.

    Its eating up the memory in 5Mb steps. Close window/open window/Close window/Open Window a.s.o.

    Each open window eats up 5MB more. I can force some paging on my 2GB box by doing it a long time

  4. #4
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    why are you creating a new ext window for the preview? Is the intention to have multiple previews open at the same time?

  5. #5

    Default

    I have a bunch of windows which i want to preview. On double click on this image in the dataview i want the preview to open. There will be only one preview open, but i want to reuse the window. There is no possibility i know to change the box component inside the window. Anyway the problem is not only with this one. Every window opened with modal will cause this leak afaik.

  6. #6
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    are you sure loading the image is not contributing?

  7. #7

    Default

    Yes. If the click is always on the same image, there is actually no reload. So image shouldnt be recreated...

  8. #8

    Default

    Moved to 2.2. The issue is solved. Consider it closed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •