For Programmers: Free Programming Magazines  


Home > Archive > MSDN > April 2006 > AJAX and Memory use problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author AJAX and Memory use problem
Pierre

2006-04-19, 6:57 pm

Hello,
I am new to AJAX technology and I'm analysing the different possibilities
this technology might bring to us. I read the different articles from
Michael Schwarz, Wikipedia and Adaptive Path. I downloaded the samples from
M. Schwarz's site and MSDN's sample "ASP.NET Spiced: AJAX".

In all samples I tried I found that the memory seems to be used but never
released.
For example: in M. Schwarz's CSharpSample project there is an example
(NewsTicker, test 13) where the Ajax Method is called each second via
javascript's setTimeout. When I run this example and I watch IE's memory
with the Task Manager, we can see that each time the method is invoked a
block of memory (12 Kb or so) is taken by IE but is never freed. This means
that after 60 seconds IE grabbed 720 Kb from the memory. What happens after
an hour?
I noticed the same issue with Microsoft's sample "Document Locker".
My questions are:
1- Does anybody can explain to me why each AJAX request creates a new
instance of the server side object? I thought that after registering the
wrapper class using "RegisterTypeForAjax" the class was "alive" and did not
need to be renewd each time.
2- Is there a way to programmatically free the memory? I tried different
ways to call the GC (even deriving from IDisposable) but the memory is never
freed.
3- Finally what am I doing wrong?

Please feel free to let me know for any question you might have if I'm not
clear enough.

Thank you for your attention,

--
Pete
Gerry Hickman

2006-04-19, 6:57 pm

Hi Pierre,

Please can you confirm if this ONLY applies to Windows and IE or do you
see the same behavior with say Linux/Mac and/or the Mozilla browser?

It doesn't surprise me that IE keeps allocating memory in this situation.

Pierre wrote:
> Hello,
> I am new to AJAX technology and I'm analysing the different possibilities
> this technology might bring to us. I read the different articles from
> Michael Schwarz, Wikipedia and Adaptive Path. I downloaded the samples from
> M. Schwarz's site and MSDN's sample "ASP.NET Spiced: AJAX".
>
> In all samples I tried I found that the memory seems to be used but never
> released.
> For example: in M. Schwarz's CSharpSample project there is an example
> (NewsTicker, test 13) where the Ajax Method is called each second via
> javascript's setTimeout. When I run this example and I watch IE's memory
> with the Task Manager, we can see that each time the method is invoked a
> block of memory (12 Kb or so) is taken by IE but is never freed. This means
> that after 60 seconds IE grabbed 720 Kb from the memory. What happens after
> an hour?
> I noticed the same issue with Microsoft's sample "Document Locker".
> My questions are:
> 1- Does anybody can explain to me why each AJAX request creates a new
> instance of the server side object? I thought that after registering the
> wrapper class using "RegisterTypeForAjax" the class was "alive" and did not
> need to be renewd each time.
> 2- Is there a way to programmatically free the memory? I tried different
> ways to call the GC (even deriving from IDisposable) but the memory is never
> freed.
> 3- Finally what am I doing wrong?
>
> Please feel free to let me know for any question you might have if I'm not
> clear enough.
>
> Thank you for your attention,
>



--
Gerry Hickman (London UK)
Pierre

2006-04-20, 7:57 am

Hi Gerry,

I made tests on different machines with different browsers but unfortunately
I could not run tests on Mac.

Windows
- IE 6.0: The "NewsTicker" works but the memory leaks.
- Firefox 1.5.0.2: The "NewsTicker" does not work at all.

Linux Red Hat Enterprise 4
- Firefox 1.0.7: The "NewsTicker" does not work at all.

Hope this information helps you. I would like to know how I can de-allocate
the memory, if it is possible.

Thank you very much for your support.

--
Pete


"Gerry Hickman" wrote:

> Hi Pierre,
>
> Please can you confirm if this ONLY applies to Windows and IE or do you
> see the same behavior with say Linux/Mac and/or the Mozilla browser?
>
> It doesn't surprise me that IE keeps allocating memory in this situation.
>
> Pierre wrote:
>
>
> --
> Gerry Hickman (London UK)
>

Gerry Hickman

2006-04-20, 6:57 pm

Hi Pierre,

I started reading:

"ASP.NET Spiced: AJAX" on MSDN and got very bored very quickly. Only
Microsoft could take a concept as simple as AJAX and make it seem so
over-complicated and try to pretend ASP.NET is somehow helpful for this.

If the news ticker doesn't work in Firefox, my best guess is that it's
badly written code - all web code should be tested on both browsers.
Unfortunately, I don't have time to start debugging Microsoft's bungled
sample code right now.

If it was me, I'd just write my own using a fraction of the number of
libraries and a fraction the number of lines of code. I tend to stick to
the open-source websites for this type of thing, rather than MSDN...

ASP.NET was always a bad choice for anything that requires client side
coding, it was just never designed with DHTML in mind - Microsoft
thought DHTML was dead and wanted to push XAML instead, but now that's
dead, and DHTML is back in full effect. Thing is DHTML is x-platform,
x-browser and XAML is not.

Pierre wrote:
> Hi Gerry,
>
> I made tests on different machines with different browsers but unfortunately
> I could not run tests on Mac.
>
> Windows
> - IE 6.0: The "NewsTicker" works but the memory leaks.
> - Firefox 1.5.0.2: The "NewsTicker" does not work at all.
>
> Linux Red Hat Enterprise 4
> - Firefox 1.0.7: The "NewsTicker" does not work at all.
>
> Hope this information helps you. I would like to know how I can de-allocate
> the memory, if it is possible.
>
> Thank you very much for your support.
>



--
Gerry Hickman (London UK)
Pierre

2006-04-25, 6:59 pm

Hello Gerry,

Thank you very much for your asnwer.

Sorry for being late but I was outside of the office since your last post.
I looked at M. Schwarz's code to realize that he used the method
"GetElementById" is his code, which is compatible only with IE so this is why
the "New Ticker" does not work with Firefox.
However I made other tests with Firefox and it seems that the memory is
better supported but I seen some leaks there too.

I would like to work "open source" but the company I'm working for develops
with MS products so...

Once again, thank you very much for your support.

--
Pete


"Gerry Hickman" wrote:

> Hi Pierre,
>
> I started reading:
>
> "ASP.NET Spiced: AJAX" on MSDN and got very bored very quickly. Only
> Microsoft could take a concept as simple as AJAX and make it seem so
> over-complicated and try to pretend ASP.NET is somehow helpful for this.
>
> If the news ticker doesn't work in Firefox, my best guess is that it's
> badly written code - all web code should be tested on both browsers.
> Unfortunately, I don't have time to start debugging Microsoft's bungled
> sample code right now.
>
> If it was me, I'd just write my own using a fraction of the number of
> libraries and a fraction the number of lines of code. I tend to stick to
> the open-source websites for this type of thing, rather than MSDN...
>
> ASP.NET was always a bad choice for anything that requires client side
> coding, it was just never designed with DHTML in mind - Microsoft
> thought DHTML was dead and wanted to push XAML instead, but now that's
> dead, and DHTML is back in full effect. Thing is DHTML is x-platform,
> x-browser and XAML is not.
>
> Pierre wrote:
>
>
> --
> Gerry Hickman (London UK)
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com