PDA

View Full Version : Possible memory leak with GridPanel and Store



sytel
31 Aug 2011, 8:35 AM
Ext version tested:

Ext 3.0.3
Ext 3.3.2
Ext 3.4.0
Adapter used:

ext
css used:

only default ext-all.css
Browser versions tested against:

IE8
IE9
FF4.0.1
FF6.0.1
Chrome 10
Chrome 12
Operating System:

Win 7 x64
WinXP Pro
Description:

There is a definite memory increase when using GridPanel with a store. Every time the store is reloaded and grid is rendered, the browser consumes more memory and it does not seem to free it. Best example is IE, which can consume over 1GB and crash within 30 minutes using the attached code.
Test Case:
Working code is attached. Unzip it into ext/examples

Steps to reproduce the problem:

Open Click on Autorefresh button
Observe memory consumption using e.g. sieve or Sysinternals Process Explorer
The result that was expected:

Stable memory footprint
The result that occurs instead:

Browser starts consuming memory until it crashes
Debugging already done:

none
Possible fix:

not provided

oniseijin
26 Oct 2011, 9:45 PM
I'm seeing this with EXT JS 4.0.7 as well.. basically calling store.load() refreshes the Grid, and the memory keeps being used (up to 1GB before the browser dies): IE + Firefox 5

sytel
27 Oct 2011, 5:58 AM
Sencha Devs, have you gotten anywhere with this one? I suspect there may actually be two issues, one with record id's and another with reader. And yes, it's still present in Ext JS 4.x.

oniseijin
27 Oct 2011, 6:45 AM
No replies yet, but I did find out that if I stopped doing the "load", the memory eventually did go down a bit. The bad news means that it might just be a standard javascript/browser/os interaction problem!

wm003
29 Dec 2011, 9:39 PM
Does it also happen when using "reload" method instead of "load" ?

Daniil
23 May 2012, 2:28 AM
We are facing the same issue. It would be great to have any answer from ExtJS team.

dcohn
24 Jul 2012, 10:40 AM
Has anyone heard from Sencha regarding this? It seems completely out of line that they're not even acknowledging it. There seems to be a similar (http://www.sencha.com/forum/showthread.php?191718-store-garbage-collection)leak in Sencha Touch that was fixed, but nothing has been done to even address the leak in ExtJS.

Daniil
24 Jul 2012, 3:56 PM
Has anyone heard from Sencha regarding this?

No, I does not. Unfortunately.

dongryphon
1 Aug 2012, 1:20 PM
Hi All -

First off, apologies for the long delay in replying. We are looking into this issue now that we have some cycles with 4.1.1 and 3.4.1 having been released.

We will update you on whether or not we can reproduce it and if there are DOM leaks going on. If there are not, it is possible that it is a browser JS issue.

For IE, has anyone tried the (IE proprietary) CollectGarbage method to see if it helps?

dracofyre
2 Aug 2012, 4:25 AM
Thanks for the heads up. My team hasn't tried the new IE CollectGarbage methods.

Daniil
2 Aug 2012, 5:22 AM
Hi Don,

Thanks for the answer!


For IE, has anyone tried the (IE proprietary) CollectGarbage method to see if it helps?

I just tried it with my test case: 5 columns, 30 records, reloading every 3 seconds, IE9.

~ 1 hour testing time increased memory from ~38000 KB to 63780 KB.

Then called CollectGarbage() on the console and it became 63144 KB. So, only ~600 KB off.

I call it several times more - no significant effect. Just a few bytes up and down.

So, I can say it doesn't help.



We will update you on whether or not we can reproduce it and if there are DOM leaks going on. If there are not, it is possible that it is a browser JS issue.


Please note it is reproducible in Chrome, FireFox and IE. Unlikely it's a browser JS issue. Though anything is possible. In that case it would be great to report it to the browsers technical support.

rich02818
10 Aug 2012, 5:35 AM
Bump...this is a show stopper...

sytel
13 Nov 2012, 4:38 AM
I create real-time reporting and monitoring applications using ExtJS, so it is crucial for me to fix this. As I suspected, there are two separate issues here:

1. ExtJS uses Douglas Crockford's implementation of JSON parser, which is the problem. I have swapped the parser for this one: http://code.google.com/p/json-sans-eval/ and that stopped the leaks.
Just include the above parser and patch ExtJS like this:

Ext.util.JSON.decode = jsonParse;
Ext.decode = jsonParse;


2. If your record id is autogenerated, it will leak.Configure your JsonReader.idProperty and make sure your id is unique. Autogenerated record id's are prefixed with 'ext-record'. This applies to all types of stores, not only JSON.

I was able to run my test case with the above modifications for 2 days without any leaks.
The same applies to ExtJS 4.x

Hope this will help.

dcohn
13 Nov 2012, 6:48 AM
This could prove to be very helpful information. But you make two very broad statements without any explanation. Can you please explain why it is that you feel that the Douglas Crockford implementation of JSON parse is the culprit, and why you think auto-generated IDs cause leaks?


Thanks

sytel
13 Nov 2012, 8:35 AM
Unfortunately I don't have enough time to identify which code actually causes the leaks. I can only do my best to help all of us fixing this problem by providing test cases and a workaround without an explanation. Please verify my claims and correct me if they are wrong.

jitaec
3 May 2013, 6:56 AM
Hi Ext Team,

My whole application is build on the ExtJs API and now we are facing the same memory leak issue. We are working on lots of data and we present it on Grid using Data stores. When opening the same grid panel again and again, the browser memory keeps growing and becomes unresponsive after some time. I found this thread after searching for any solution. I did not see any last response with the issue to be fixed. Can you suggest any solution of the issue. It will be a great help.

Thanks,
Jitesh

Daniil
2 Jun 2013, 10:28 PM
My whole application is build on the ExtJs API and now we are facing the same memory leak issue. We are working on lots of data and we present it on Grid using Data stores. When opening the same grid panel again and again, the browser memory keeps growing and becomes unresponsive after some time. I found this thread after searching for any solution. I did not see any last response with the issue to be fixed. Can you suggest any solution of the issue. It will be a great help.


Hi @jitaec,

Are you using ExtJS 3 or 4?

EDIT: I think I reproduced it with ExtJS 4.
http://www.sencha.com/forum/showthread.php?265051

Also I can confirm that the issue is still actual for ExtJS 3.

rich02818
3 Jun 2013, 5:58 AM
You'd think that 22 months would be enough time for Sencha to 'review' this problem...

Anyone else worried about being dependent upon Sencha's support?

Oliver Timm
26 Jun 2014, 5:17 AM
Whatīs the actual status? Is Sencha working on this issue? I have this problem in my web application with ExtJS 3.4.1. And to answer the possible question: No, itīs no option to increase the refresh limit of 5 seconds.

sytel
26 Jun 2014, 6:08 AM
Has anyone tried to apply suggestions from post #13?

Oliver Timm
27 Jun 2014, 2:46 AM
The suggestions from post #13 arenīt relevant for me because I have an xml store and all rows have an id. The problem of high increasing memory still exists.

grdrew
15 Aug 2014, 2:14 AM
I have the same problem with a memory leak in a REST store in both v4 and v5.

I create a v5 app using sencha cmd, added a REST store and a dynamic task in which I load/reload the store every 1 second, nothing else going on, just the load, but in less than a day both FF and chrome will crash because of the memory leak.

It looked like a problem with the data.proxy.Rest reader, but it was to difficult to work out exactly what was leaking. In the end I decided to bypass the data.proxy.Rest reader and write my own simple XMLHttpRequest handler, manually loading the response into the store.

This solved the leak in the store but now I have a chart linked to another store that is updating every 4 seconds and the chart seems to be leaking memory as well.

Does everything in EXT leak? Any attempt at writing a serious SPA that's intended to run continually seems doomed to fail.

dongryphon
16 Aug 2014, 8:17 PM
@grdrew -

Can you post a fiddle (https://fiddle.sencha.com) for me to look at?

rich02818
17 Aug 2014, 4:40 AM
@grdrew -

Can you post a fiddle (https://fiddle.sencha.com) for me to look at?

Over 2 years ago you said you'd try to reproduce this leak problem in v3 and report back, and never did so. Now that someone mentions v5 you show some interest??

Pardon me for thinking that the "support" for v3 is purely words and no action. I'd love to be shown that I'm wrong...

grdrew
20 Aug 2014, 1:06 AM
@grdrew -

Can you post a fiddle (https://fiddle.sencha.com) for me to look at?

I can't really post a fiddle, I have a closed intranet setup, with a dedicated datasnap web server processing the requests, so I couldn't post a fiddle that would emulate the problem I was seeing. I did add a post to the v5 Q&A forum which has my code in it and a full description of the problem I was seeing,

http://www.sencha.com/forum/showthread.php?289744-Memory-leak-in-REST-store-extjs-v4-and-v5

I really did nothing more than create the app with sencha cmd, add a REST store and a dynamic task running every second which did a store load, then ran the app on a pc other than the one the web server was running on, and after only a day of this FF would have crashed. It seems such a fundamental problem that I pretty sure it must be something to do with my code or setup, otherwise other people would see it.