We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Memory usage increases by 30MB every timer tick

Hello syncfusion.

I created a Syncfusion project for webforms a while ago.
The idea of the program is that its a live monitoring tool (display the data for current day/week). Once every x amount of seconds it sends a trigger to the code behind to get some data from the a database, do some calculations with it and then display the data in some labels and on a few circulargauges. 

I got everything to work pretty decently, however every time it loads the new data the memory usage increases by ~30MB. With a refresh rate of 6 times per minute it takes about 4minutes till the memory usage reaches like 720MB. So it gets out of hand real quick.

At first it thought i maybe had a memory leak in the code behind. After changing all the database connections to dispose correctly by using:
 using(SqlConnection mksql = new SqlConnection(connectionStringmksql)){} i found out the memory leak wasnt caused by the code behind but mainly because of the circulairgauges (and some labels).

I found that out because i removed the circulargauges code (and the code behind code that sets the value of these gauges) for the aspx page and then the memory usage remained pretty stable at 89MB. Only increasing a little (to 92MB) when the trigger hits but it returns to 89MB. 

So i can confidently say its because of the circulargauges. What am i doing wrong with updating them that causes the browser to store extra data everytime? I also tried to change the VIEWSTATE to disabled but it doesnt help either.

In the code that i have attached (couldnt attach the whole project but its everything except for the bin folder) i commented out the data retrieving functions from the database (to show it isnt the cause of the memory usage increase and because i cant publish the database data easily).

I hope you can help me with my problem. Im fairly new to ASP.NET so im probably making a stupid mistake somewhere but i cant find a way to fix this.

Attachment: Project_771f9487.rar

6 Replies

BP Baby Palanidurai Syncfusion Team May 29, 2019 01:46 PM UTC

Hi Pim, 

Greetings from Syncfusion. 

We have analyzed your query. We have prepared a sample based on your sample code snippet and we are checking the reported memory leak issue and we will update you the further details within two business day(31st May, 2019). We appreciate your patience until then. 


PI pim May 29, 2019 04:57 PM UTC

Thanks for the reply and letting my know that you are checking my issue.

In the meanwhile i was able to narrow down the cause of the leak by reproducing it by starting a fresh project with the Syncfusion toolbar -> Essential studio for winforms -> Create New Syncfusion Project.
I cleared the default page and most of the Site.Master (removed everything from the body except for the , scriptmanager and contentplaceholder), 
Put in an asp:Timer with Interval=1000 (just to speed up the process),
Put in a UpdatePanel,
In the UpdatePanel put the trigger for the Timer to cause an AsyncPostBack,
In the ContentTemplate of the UpdatePanel put a CircularGauge from the toolbox and changed it to:
ClientIDMode="static" IsResponsive ="true" runat="server" ID="G1" BackgroundColor="transparent" Load="loadGaugeTheme" AnimationSpeed="200"> 

So no code behind, just 2 gauges, updatepanel and a timer that triggers the update panel. 

Every second the memory usage of chrome increases by like 2-3MB. So im pretty sure the leak isnt from my c# code but from either the UpdatePanel, the CircularGauge or a combination of them both.

Removing the IsRepsponsive="true" part from the CircularGauge causes the memory to drop back to normal after 4-5refreshes. So the first 4 cycles it still climbs 2-3MB but after the 5th cycle it drops back to where it started. I dont know exactly what the IsResponsive="true" part does but it was copied from the examples. So for the little test project above that fixed it However it didnt fix it totally for the total project but it is a start.

BP Baby Palanidurai Syncfusion Team May 30, 2019 01:25 PM UTC

Hi Pim, 
Thanks for your update. 
We have checked the reported scenario at our end. Based on your scenario and replication steps, we have prepared a sample with only two gauges and we can replicate the reported issue at our end. Gauge control has support for responsive behavior based on the client browser’s width and height. IsResponsive property is used to enable the responsive.  When we resize the browser or reload the page, then the gauge size will be updated. For this purpose only, isResponsive used.  
Like your state, we have checked with set false to isResponsive, then there is no memory leak. So, if you don’t require IsResponsive, kindly remove this property. Kindly check with this with your entire project and kindly reverts with details about what is the purpose you need isResponsive. So that we will consider fixing the reported scenario at our end. 

PI pim June 5, 2019 01:45 PM UTC

Sorry for the late reply but no i dont need the IsResponsive. I only had it in there because the first time i created a circulargauge it was a copy paste from the demo.

However removing the IsResponsive didnt fix all of my memory leaks. I had to idea to begin from scratch again and add parts of the code to see what causes it. Guess what... after having added everything back the memory usage didnt keep building up. Well it builds up like 20MB every timer tick but after 3-4 refreshes it drops back to normal. So for whatever reason that issue is fixed. Sadly a new issue appeared. For some reason the DateRangePicker and the NumericUpDowns no longer have their icons next to them and the size is different (they are wider then they used to be and have less height then they normally have). They just look like normal textboxes now. 

The DateRangePicker normally has a calendar like icon next to its textbox that when you click on it opens the selector menu. And the NumericUpDown normally have those up and down icons next to them. 

Even when i add a new web form to the project and add a DateRangePicker from the toolbar and then run IIS Express it just shows a textbox like control withouth the calendar icon. However when i put my mouse on it to write something it does show the history of date ranges i have entered before.

After testing other syncfusion controls it seems like they arent rendered correctly a toggle buttons shows as a checkbox and a normal button instead of a toggle button. So im not sure what i did wrong in creating the project from scratch. It fixed the memory leak issue but now the syncfusion controls dont display like they normally would. Do you have any idea what would cause this? The total project is 381MB so i still cant attach it to this message, is there maybe another way i could share the project with you so you could check the problem out yourself? Zipped its around 76MB

PI pim June 5, 2019 02:19 PM UTC

So i found the reason that caused the controls to not render correctly.
I still had to add:
  < appSettings >
    <  add key="LoadEJResourcesFromAssembly" value="true" />
    <  add key="EJResources" value="jsrender:true;themes:true;" />
  < /appSettings >

to the masterpage.

Sadly this caused the project to have a memory leak again. So before i added those lines the memory build 20MB per tick but dropped back to normall after 4ticks but the DateRangePicker and NumericUpDowns didnt render correctly. After adding those lines the controls rendered correctly again but the memory never drops back to normall so it just keeps building every tick. Do you have any idea why this causes the leak and how i can fix the memory leak?

Thanks in advance for your time

AB Ashokkumar Balasubramanian Syncfusion Team June 7, 2019 12:38 PM UTC

Hi Pim, 
We have checked the reported scenario and suspect that the DateRangePicker look like a normal textbox because of following two reasons 
a.     jQuery is referred twice in your application with different version. You will need to remove the jquery in your asp:scriptmanager (master page). If you really want to access the two jQuery script files in a single application just add the $.noConflict() in script section at master page. In that code, you will able to access the two jQuery with different version. 
b.     ej.web.all.min.js file path is not referred properly in your application 
If this is not your case, then please revert me with reproduce the issue with attached sample or else clear the bin, obj folders from your project and share with us. So, that we can able validate and update the exact solution to resolve this issue at earlier. 
We have checked the memory leak issue, which occurs because of loading the scripts from assembly which maintains the interaction between the application and browser whenever the page loads which increases the memory usage. So, kindly refer the external scripts in your application to resolve this memory leak issue as it maintains a constant memory usage and turn off the setting by LoadEJResourcesFromAssembly as false. 
<add key="LoadEJResourcesFromAssembly" value="false" /> 
Please let us know, if you have any concern on this. 
Ashokkumar B. 

Live Chat Icon For mobile
Up arrow icon