I am creating the flex pivot as below:
$scope.mainPivot = $(pivotGridSelector).flexmonster({
global: {
localization: $scope.flexPivot.LocaleData //localeJsonpath
},
customizeCell: customizeCellFunction,
licenseKey: response.licenseKey,
beforetoolbarcreated: customizeToolbar,
componentFolder: "libs/flexmonster/",
toolbar: true,
height: "100%",
width: "100%",
report: flexReport
});
and on angular scope destroy, I have following code:
$scope.$on("$destroy", function() {
$scope.mainPivot.dispose();
});
But I still see detached dom tree and they are pointing to flex nodes. What am I missing?
My application is leaking around 30MB everytime, when I open the page with flex and close it every time.
Please suggest.
Hello Sohan,
Thank you for your question. Could you please provide us with the sample project so we can make some tests and reproduce the issue on our side? It will help us a lot in our further investigation.
Best regards,
Dmytro.
Here is the fiddle for the same. I have not included angular code here,just flex pivot.
https://jsfiddle.net/sohansoni/qae2sxzk/3/
Observe the memory usage when this page is launched. Then do the create and dispose several times.
Observe the memory usage, It has gone up. Now in chrome dev tools take a heap snapshot.
I see lot of Detached DOM Tree related to flex
Hello Sohan,
Thank you for providing us with the example. We need to take some time on the investigation. The fix will be presented in the 2.4 major update which is going to be released in a month.
Best regards,
Dmytro.
Thanks Dmytro, But were you able to reproduce it ?
Hello Sohan,
Yes, we have reproduced the issue.
Best regards,
Dmytro.
Thank you for the confirmation !
Hello,
I see new major upgrade 2.403 released on 11th Sep 17, does it include memory leak fix ?
Hello Sohan,
Yes, we have optimized memory usage in the version 2.4.
So you are welcome to download the latest 2.403 release and try it.
Please let us know if it helps to resolve the memory leak.
Regards,
Ian
I am afraid to say this but this is still not resolved. Can you please look into it ?
While analyzing on chrome dev tools if I disable customizeCell and toolbar, then memory leak is reduced.
However with no toolbar and no custom customizeCell function, memory is still getting leaked, and I still see customizecell function taking lot of memory, even updateLabels function.
Hi Sohan!
Could you please send us a sample with the memory leak issue? We've made some tests but they show only small leaks but I think in your case, it should be several megabytes per update.
Thanks
Apologies for the delay on replying on this one.
I have created the fiddle which demonstrates memory leak.
Fiddle : https://jsfiddle.net/6rLqgvce/4/
Steps:
Hello Sohan,
Thank you for such detailed description.
I see the difference in memory usage. We will try to fix the leak and will update you with our findings (approximately on Dec 04). Does it work for you?
Regards,
Ian
Yes, it works for me
Is this fixed in 2.409 ?
Hello Sohan,
Thank you for writing.
The fix is available in the version 2.409, you are welcome to download it from our website. Please note that the fix was added only to 2.4 version.
Let us know if everything works fine for you.
Regards,
Dmytro.
Dymtro,
I have tested with 2.409 and looks like there is still huge memory leak.
Please refer this fiddle http://jsfiddle.net/sohansoni/rkprvhhs/228/
take heap dump before creating pivot, create pivot and dispose it. Now take heap dump again.
The difference is around 6.5 MB !!!
I can walk you through with where exactly are the leaks if you want. But please fix these. We really need them to be fixed.
Hello Sohan,
Thank you for the update.
Could you please provide us with the jsfiddle example? It is seemed to be missing in your previous post.
Waiting for the example to clarify the issue.
Regards,
Dmytro.
Sorry, here you go: http://jsfiddle.net/sohansoni/rkprvhhs/228/
Hello Sohan,
Thank you for providing us with the jsfiddle example. We will increase the priority of this issue and will notify you as soon as it is ready.
Regards,
Dmytro.
Hello Sohan,
Thank you for giving us some time for making further investigation.
We followed the steps you provided and we see the difference is around 6.5MB between the newly loaded page and the page after one create() and one dispose(). Also, we measured the memory usage between each consecutive create() call. It is increasing approximately by 100KB after each consecutive create(). Here is the video - https://www.screencast.com/t/uGGk73HwPcy. Thus, 6.5MB is a one-time increase. We agree that ideally there should not be any increase at all, but at the same time after the previous rounds of improvements we consider the current increase as an acceptable. Please let us know your thoughts.
Also, we'd like to mention that each time a new instance of the component is created, the dispose() API call is triggered automatically for the previous one, thus, there is no need to call dispose() before the creation explicitly.
Kind regards,
Iryna
Iryna, unfortunately each consecutive create is leaking almost 1MB of memory. I can show you that. 100KB would be perfectly fine but it's not the case right now. I want to help you on this so that we can further reduce the leak.
Lets have a call where we can do webex.
Hello Sohan,
Thank you for your willingness to help us on this issue.
Olena will contact you to arrange further steps.
Kind regards,
Iryna
Looks like memory leak is finally resolved in 2.411. Thanks for all the hard work.
I am sure memory leak reduction help all of us.