Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've got a very simple visual webpart and I'm trying to figure out why. In IE9, after about 10 minutes, memory usage has slowly climbed up about 5MB. If I let it keep running, it'll just keep on using more and more memory. I've briefly tested this in Chrome and it also seems to eat up memory, but nowhere near as fast.

Here's the page code

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>     
    <asp:Label ID="label2" runat="server" Font-Size="40pt" />
</ContentTemplate>
</asp:UpdatePanel>

and the code behind for the Timer_Tick is just updating the time for the label

    protected void Timer1_Tick(object sender, EventArgs e)
    {
        label2.Text = DateTime.Now.ToLongTimeString();
    }

It seems like it should be simple. I've played around with a disposing the UpdatePanel, but that didn't seem to help. Am I missing something here? Any suggestions?

share|improve this question
    
How often is your timer ticking? –  Mike Nov 26 '12 at 22:39
    
If you are running this in Chrome, run the profiler on it, check the javascript and network, you will be able to see where the memory leak is happening from that. Also this is a common problem with AsyncPostBackTrigger, I have seen in in ASP.Net before in StackExchange. Might be worth looking at that? –  Hugh Wood Nov 26 '12 at 23:03
    
For testing purposes, the timer was ticking every 5 seconds. –  Jef Nov 27 '12 at 16:37
add comment

1 Answer 1

Jef,

Instead of using Update Panel, you can use Web service with AJAX behaviour as described in this article:
AJAX Style Web Parts in SharePoint the Easy Way

He is exactly doing the same thing you are trying... Also for repetitive calls you can use javascript setTimeout(functionName,1000)

I hope this helps

share|improve this answer
    
Thanks for the link, I'm checking it out. I don't have much experience with Javascript, but I'm digging through it. –  Jef Nov 27 '12 at 18:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.