Results 1 to 2 of 2

Thread: Memory Leak in list grid filter (Ext.grid.filters.filter.List) 5.1.1.451

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-18225 in 5.1.2.
  1. #1
    Sencha Premium Member
    Join Date
    Aug 2013
    Posts
    6

    Exclamation Memory Leak in list grid filter (Ext.grid.filters.filter.List) 5.1.1.451

    Ext version:

    • 5.1.1.451
    Browser used:
    • Chrome 43.0.2357.124 m
    Description:
    • Memory leaks when using list filter along with a store from viewmodel
    Steps to reproduce the problem:
    • https://fiddle.sencha.com/#fiddle/ohf
    • Record heap allocation and observe leaks every time when you click buttons open grid and close grid. run it couple of times and measure the leak in every round. In this simple example it is around 300KB each time.
    Expected Result:
    • Blue bars of memory heap should turn gray after you close the grid or at least when you close the grid 2nd time given some caching factors. If you drill down to retainers, you will see that memory is not releasing because of listeners in empty store.
    • Heap snap shot also leads to same result.
    When and Why it happens:
    • It happens only when we use a store from view model where store binding happens at later stage. In recent releases of Ext 5 we have introduced a code block which registers some store data change events to change the list menu values. here is the code block from constructor

    • me.getGridStore().on({ scope: me, add: me.onDataChanged, refresh: me.onDataChanged, remove: me.onDataChanged, update: me.onDataChanged });
    at the time this executes, real store is not available and empty store is returned where binding of events happened. later at the time of destroy, real store is available and event binding with empty store is not getting destroyed which results into retaining path in memory and GC is not able to collect memory.

    Possible Workarounds:
    1) We can override the constructor and remove the event registration at the cast of list menu not updating when store data changes in case of filters applied.

    2) We can move the event registration code above to a place where real store is available like bindMenuStore which triggers after store load.

    3) a quick and dirty fix could be nullify the events in empty store in destroy method of list. I am not sure of side issues though but it resolves the memory leaks

    var empStr = Ext.StoreManager.get('ext-empty-store');
    if (empStr)
    empStr.events = null;


    Disclaimer
    I might be totally wrong in my assumptions and conclusions, workarounds might cause other side issues which I can not guarantee so you better test, verify and test again.



    thanks,
    Fahad

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Similar Threads

  1. [FIXED] Ext.grid.filters.filter.List not respecting documentation
    By nbourdeau in forum Ext 5: Bugs
    Replies: 2
    Last Post: 22 Nov 2014, 3:16 PM
  2. Can I bind options to Ext.grid.filters.filter.List?
    By khmurach in forum Ext 5: Q&A
    Replies: 1
    Last Post: 3 Nov 2014, 3:52 PM
  3. Replies: 1
    Last Post: 20 Aug 2014, 1:14 PM
  4. Replies: 2
    Last Post: 14 Mar 2012, 4:41 AM

Tags for this Thread

Posting Permissions

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