473,396 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

memory leak in asp 2.0

I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users) I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may be
the reason. I expected that when I load new page, every variable that I use
in old page releases memory. How I can find where I did not release memory.
I call each time 'Page unload' when I load new page but never when I close
it.

Jul 31 '07 #1
11 1462
Aleks,
What you describe is not a normal operating condition and may very well be
caused by poorly written code (e.g, not closing connections, etc.)
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Aleks Kleyn" wrote:
I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users) I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may be
the reason. I expected that when I load new page, every variable that I use
in old page releases memory. How I can find where I did not release memory.
I call each time 'Page unload' when I load new page but never when I close
it.
Aug 1 '07 #2
I do not have recursion. The code is prety simple. At logon I open dataset
and appropriate tableadapters and save them and few datatables in session.
Some datatables I may fill on different pages. Some datatables I use on
diferent tables to databind controls. May be dataadapter should be open for
short time or control has hiden recursion.
Also it would be useful to know how much specific page gets in memory or
when I leave it forever, so I can release it forever.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.comwrote
in message news:33**********************************@microsof t.com...
Aleks,
What you describe is not a normal operating condition and may very well be
caused by poorly written code (e.g, not closing connections, etc.)
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Aleks Kleyn" wrote:
>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users)
I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may
be
the reason. I expected that when I load new page, every variable that I
use
in old page releases memory. How I can find where I did not release
memory.
I call each time 'Page unload' when I load new page but never when I
close
it.
Aug 1 '07 #3
I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other
users) I put in application. I expected that it will get some amount
of memory, however I expected that this amount of memory will be fixed
and will depend on number of user. When I put code in production I
discovered that aspnet_wp.exe increases memory which it uses. Each
second 2meg. What may be the reason. I expected that when I load new
page, every variable that I use in old page releases memory. How I can
find where I did not release memory. I call each time 'Page unload'
when I load new page but never when I close it.
What do you mean by "I call each time 'Page unload'"?

You may place code in an Unload eventhandler, but that is called automatically.

Hans Kesting
Aug 1 '07 #4
Keep an eye out for Connections that are not immediately closed when filling
or updating your DataSets.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:E6**********************************@microsof t.com...
>I do not have recursion. The code is prety simple. At logon I open dataset
and appropriate tableadapters and save them and few datatables in session.
Some datatables I may fill on different pages. Some datatables I use on
diferent tables to databind controls. May be dataadapter should be open for
short time or control has hiden recursion.
Also it would be useful to know how much specific page gets in memory or
when I leave it forever, so I can release it forever.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.com>
wrote in message
news:33**********************************@microsof t.com...
>Aleks,
What you describe is not a normal operating condition and may very well
be
caused by poorly written code (e.g, not closing connections, etc.)
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Aleks Kleyn" wrote:
>>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users)
I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may
be
the reason. I expected that when I load new page, every variable that I
use
in old page releases memory. How I can find where I did not release
memory.
I call each time 'Page unload' when I load new page but never when I
close
it.

Aug 1 '07 #5
Almost certainly the problem is in storing large amount of data in session
variables. See if you can minimize it. Another idea is to use out-of-process
session management.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:69**********************************@microsof t.com...
>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users) I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may be
the reason. I expected that when I load new page, every variable that I use
in old page releases memory. How I can find where I did not release memory.
I call each time 'Page unload' when I load new page but never when I close
it.

Aug 1 '07 #6
I tried to add 'page unload' to code of web page. No code, just break point.
When page loads or I click button on the page I stop at the break point.
When I close page I do not have any break point.
"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:c0**************************@news.microsoft.c om...
>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other
users) I put in application. I expected that it will get some amount
of memory, however I expected that this amount of memory will be fixed
and will depend on number of user. When I put code in production I
discovered that aspnet_wp.exe increases memory which it uses. Each
second 2meg. What may be the reason. I expected that when I load new
page, every variable that I use in old page releases memory. How I can
find where I did not release memory. I call each time 'Page unload'
when I load new page but never when I close it.

What do you mean by "I call each time 'Page unload'"?

You may place code in an Unload eventhandler, but that is called
automatically.

Hans Kesting

Aug 2 '07 #7
Probably you are right. Do you mean that I need to try web service? Or there
are other ways also?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ur*************@TK2MSFTNGP05.phx.gbl...
Almost certainly the problem is in storing large amount of data in session
variables. See if you can minimize it. Another idea is to use
out-of-process session management.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:69**********************************@microsof t.com...
>>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users) I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may
be the reason. I expected that when I load new page, every variable that I
use in old page releases memory. How I can find where I did not release
memory. I call each time 'Page unload' when I load new page but never
when I close it.

Aug 2 '07 #8
Minimizing session using and disposing variables is an architectural
decision.

Out-of-process session management means using either a special Windows
service available in asp.net or a SQL Server database. Switching to the
Windows service is simple but you may need to put a [Serializable] attribute
on the classes you put into session..

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:5C**********************************@microsof t.com...
Probably you are right. Do you mean that I need to try web service? Or
there are other ways also?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ur*************@TK2MSFTNGP05.phx.gbl...
>Almost certainly the problem is in storing large amount of data in
session variables. See if you can minimize it. Another idea is to use
out-of-process session management.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:69**********************************@microso ft.com...
>>>I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users)
I put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What may
be the reason. I expected that when I load new page, every variable that
I use in old page releases memory. How I can find where I did not release
memory. I call each time 'Page unload' when I load new page but never
when I close it.


Aug 2 '07 #9
I did today search for session out of state on Microsoft site and found site
http://msdn2.microsoft.com/en-us/library/ms972429.aspx
However not studio 2005, nor Orcas can accept code
<configuration>
<sessionstate
Not in XP, neither in server 2003. It means that at least at this time I
cannot use this code. Probably the best solution is to reopen dataset each
time when I load new page. Probably also to keep this code in separate web
service which will return only datatable or datarow. As I remember from my
past experince web service cannot keep values when I go from one page to
another. This way I loose the essential of dataset.

I put attention to another thing. I put in the corner of screen task
manager, so I was able to watch how much memory I need. I used 2 pages.
First page plain asp code, second initialize dataset, can abandon session if
I want and to return to the first page. When I load first page the memory
grew up to 60mb. Second page sometimes added 2-5mb, sometimes nothing.
Memory reduced it size very rare. If I did long break between loading of
first page it could increase memory up to 10mb (Even i did not allocate
there any variable). This way I increse memory up to 130mb. The same code in
asp 1.0 takes only 14mb. It means that garbage collection does not work is
it suppose to be.

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OM**************@TK2MSFTNGP04.phx.gbl...
Minimizing session using and disposing variables is an architectural
decision.

Out-of-process session management means using either a special Windows
service available in asp.net or a SQL Server database. Switching to the
Windows service is simple but you may need to put a [Serializable]
attribute on the classes you put into session..

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:5C**********************************@microsof t.com...
>Probably you are right. Do you mean that I need to try web service? Or
there are other ways also?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ur*************@TK2MSFTNGP05.phx.gbl...
>>Almost certainly the problem is in storing large amount of data in
session variables. See if you can minimize it. Another idea is to use
out-of-process session management.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:69**********************************@micros oft.com...
I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users)
I put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend on number of user. When I put code in production I discovered
that aspnet_wp.exe increases memory which it uses. Each second 2meg.
What may be the reason. I expected that when I load new page, every
variable that I use in old page releases memory. How I can find where I
did not release memory. I call each time 'Page unload' when I load new
page but never when I close it.


Aug 3 '07 #10
You want to tell that dataadapter in dataset is connection to database. Why
then I need so much connections to database. Why one connection cannot serve
all tables in dataset? And if I forced to reopen dataset each time when I
load new page why I cannot close dataset as soon as it finished?
it possible that I did not understand something. keep eye out means to watch
closely or not to tuch? Or you mean that I think that datatable is filled
and ready to bind control while in reality these procedures work parallel?
"Kevin Spencer" <un**********@nothinks.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Keep an eye out for Connections that are not immediately closed when
filling or updating your DataSets.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:E6**********************************@microsof t.com...
>>I do not have recursion. The code is prety simple. At logon I open dataset
and appropriate tableadapters and save them and few datatables in session.
Some datatables I may fill on different pages. Some datatables I use on
diferent tables to databind controls. May be dataadapter should be open
for short time or control has hiden recursion.
Also it would be useful to know how much specific page gets in memory or
when I leave it forever, so I can release it forever.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.com>
wrote in message
news:33**********************************@microso ft.com...
>>Aleks,
What you describe is not a normal operating condition and may very well
be
caused by poorly written code (e.g, not closing connections, etc.)
Peter
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
bogMetaFinder: http://www.blogmetafinder.com

"Aleks Kleyn" wrote:

I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other
users) I
put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend
on number of user. When I put code in production I discovered that
aspnet_wp.exe increases memory which it uses. Each second 2meg. What
may be
the reason. I expected that when I load new page, every variable that I
use
in old page releases memory. How I can find where I did not release
memory.
I call each time 'Page unload' when I load new page but never when I
close
it.

Aug 3 '07 #11
One question more. i think it is very important. Assume class has private
dataset and public rowset. Now. When I put this object into collection (in my
case session) what do I really put inside collection. If I put object itself,
this is really huge demand to the memory. But if I put reference then this is
no matter how large object is.

However question may be put differently. In what address space does object
exist. If to be placed into session it should exist in session then it will
be better to create web service. But even in this case I not sure that when I
put object which refers to web service into session I will not put into
session the whole staff.

"Aleks Kleyn" wrote:
I did today search for session out of state on Microsoft site and found site
http://msdn2.microsoft.com/en-us/library/ms972429.aspx
However not studio 2005, nor Orcas can accept code
<configuration>
<sessionstate
Not in XP, neither in server 2003. It means that at least at this time I
cannot use this code. Probably the best solution is to reopen dataset each
time when I load new page. Probably also to keep this code in separate web
service which will return only datatable or datarow. As I remember from my
past experince web service cannot keep values when I go from one page to
another. This way I loose the essential of dataset.

I put attention to another thing. I put in the corner of screen task
manager, so I was able to watch how much memory I need. I used 2 pages.
First page plain asp code, second initialize dataset, can abandon session if
I want and to return to the first page. When I load first page the memory
grew up to 60mb. Second page sometimes added 2-5mb, sometimes nothing.
Memory reduced it size very rare. If I did long break between loading of
first page it could increase memory up to 10mb (Even i did not allocate
there any variable). This way I increse memory up to 130mb. The same code in
asp 1.0 takes only 14mb. It means that garbage collection does not work is
it suppose to be.

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OM**************@TK2MSFTNGP04.phx.gbl...
Minimizing session using and disposing variables is an architectural
decision.

Out-of-process session management means using either a special Windows
service available in asp.net or a SQL Server database. Switching to the
Windows service is simple but you may need to put a [Serializable]
attribute on the classes you put into session..

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:5C**********************************@microsof t.com...
Probably you are right. Do you mean that I need to try web service? Or
there are other ways also?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ur*************@TK2MSFTNGP05.phx.gbl...
Almost certainly the problem is in storing large amount of data in
session variables. See if you can minimize it. Another idea is to use
out-of-process session management.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Aleks Kleyn" <Al*********@MailAps.orgwrote in message
news:69**********************************@microso ft.com...
I wrote application on asp.net 2.0 using dataset. One dataset I put in
session collection and other (which is small and common for other users)
I put in application. I expected that it will get some amount of memory,
however I expected that this amount of memory will be fixed and will
depend on number of user. When I put code in production I discovered
that aspnet_wp.exe increases memory which it uses. Each second 2meg.
What may be the reason. I expected that when I load new page, every
variable that I use in old page releases memory. How I can find where I
did not release memory. I call each time 'Page unload' when I load new
page but never when I close it.
Aug 3 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.