473,385 Members | 1,478 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,385 software developers and data experts.

Memory management problem

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB in size.
After page is processed the size does not comes down. I have tried
a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to manage
this uncontrolled situation. pls help.
samik

Nov 19 '05 #1
6 1078
samik wrote:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
in size. After page is processed the size does not comes down. I have
tried a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to
manage this uncontrolled situation. pls help.
samik


The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact that it
doesn't immediatly decrease probably does surprise you, but is
is correct!

Try loading this page a couple of times and see the memory consumption.
It probably will go up again at first, but after a couple of times that memory
consumption will stop or it will go down. It may also go down after
you wait a while.

This is garbage collection at work. Memory that your application doesn't use
anymore is not immediately returned to the operation system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting
Nov 19 '05 #2
thanks for ur reply.
actually we have a problem that the process size becomes ever growing when a
bigger load is there. and after growing upto 450-500 MB the process hang. So
we have to have a mechanism through which we can release this unused memory
asap. can u suggest something...
"Hans Kesting" wrote:
samik wrote:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
in size. After page is processed the size does not comes down. I have
tried a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to
manage this uncontrolled situation. pls help.
samik


The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact that it
doesn't immediatly decrease probably does surprise you, but is
is correct!

Try loading this page a couple of times and see the memory consumption.
It probably will go up again at first, but after a couple of times that memory
consumption will stop or it will go down. It may also go down after
you wait a while.

This is garbage collection at work. Memory that your application doesn't use
anymore is not immediately returned to the operation system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting

Nov 19 '05 #3
thanks for ur reply.
actually when the load inceases. this process size becomes virtually ever
growing. it comes down only in a few bytes and increases in MB. after going
upto 450-500MB the process hangs. So we need to control this size. Can u
suggest something?

"Hans Kesting" wrote:
samik wrote:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
in size. After page is processed the size does not comes down. I have
tried a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to
manage this uncontrolled situation. pls help.
samik


The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact that it
doesn't immediatly decrease probably does surprise you, but is
is correct!

Try loading this page a couple of times and see the memory consumption.
It probably will go up again at first, but after a couple of times that memory
consumption will stop or it will go down. It may also go down after
you wait a while.

This is garbage collection at work. Memory that your application doesn't use
anymore is not immediately returned to the operation system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting

Nov 19 '05 #4
samik wrote:
thanks for ur reply.
actually we have a problem that the process size becomes ever growing
when a bigger load is there. and after growing upto 450-500 MB the
process hang. So we have to have a mechanism through which we can
release this unused memory asap. can u suggest something...

Maybe this link will help:
http://msdn.microsoft.com/library/de...Collection.asp

"Hans Kesting" wrote:
samik wrote:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
in size. After page is processed the size does not comes down. I
have tried a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to
manage this uncontrolled situation. pls help.
samik


The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact
that it doesn't immediatly decrease probably does surprise you, but
is
is correct!

Try loading this page a couple of times and see the memory
consumption.
It probably will go up again at first, but after a couple of times
that memory consumption will stop or it will go down. It may also go
down after
you wait a while.

This is garbage collection at work. Memory that your application
doesn't use anymore is not immediately returned to the operation
system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting

Nov 19 '05 #5
Samik,

That is the answer I am eager to know to. From the MSDN reference, looks
like there is still not a good way to quickly remove the memory usage. So
did you ever find a useful solution?

Thanks in advance,
Agnes

"samik" wrote:
thanks for ur reply.
actually when the load inceases. this process size becomes virtually ever
growing. it comes down only in a few bytes and increases in MB. after going
upto 450-500MB the process hangs. So we need to control this size. Can u
suggest something?

"Hans Kesting" wrote:
samik wrote:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim a As ArrayList, i As Long
a = New ArrayList
For i = 1 To 1000000
a.Add(10)
Next
End If
End Sub

This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
in size. After page is processed the size does not comes down. I have
tried a.clear()
me.dispose()

whether i put 'a' in session or not, the process grows. I want to
manage this uncontrolled situation. pls help.
samik


The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact that it
doesn't immediatly decrease probably does surprise you, but is
is correct!

Try loading this page a couple of times and see the memory consumption.
It probably will go up again at first, but after a couple of times that memory
consumption will stop or it will go down. It may also go down after
you wait a while.

This is garbage collection at work. Memory that your application doesn't use
anymore is not immediately returned to the operation system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting

Nov 19 '05 #6
Hi,

Did you try to explicitly call GC.Collect()?

Hope this helps,
Martin Dechev
ASP.NET MVP
"Agnes" <Ag***@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
Samik,

That is the answer I am eager to know to. From the MSDN reference, looks
like there is still not a good way to quickly remove the memory usage. So
did you ever find a useful solution?

Thanks in advance,
Agnes

"samik" wrote:
thanks for ur reply.
actually when the load inceases. this process size becomes virtually ever growing. it comes down only in a few bytes and increases in MB. after going upto 450-500MB the process hangs. So we need to control this size. Can u
suggest something?

"Hans Kesting" wrote:
samik wrote:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> If Not IsPostBack Then
> Dim a As ArrayList, i As Long
> a = New ArrayList
> For i = 1 To 1000000
> a.Add(10)
> Next
> End If
> End Sub
>
> This code causes the process aspnet_wp.exe to grow form 2MB to 45MB
> in size. After page is processed the size does not comes down. I have > tried a.clear()
> me.dispose()
>
> whether i put 'a' in session or not, the process grows. I want to
> manage this uncontrolled situation. pls help.
> samik

The fact that memorysize increases probably doesn't surprise you
(as you are adding a million values to that arraylist). The fact that it doesn't immediatly decrease probably does surprise you, but is
is correct!

Try loading this page a couple of times and see the memory consumption. It probably will go up again at first, but after a couple of times that memory consumption will stop or it will go down. It may also go down after
you wait a while.

This is garbage collection at work. Memory that your application doesn't use anymore is not immediately returned to the operation system, only when
the garbage collector comes around to it. This might happen when the
application is idle or when available memory is too low.

Hans Kesting

Nov 19 '05 #7

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

Similar topics

18
by: Tron Thomas | last post by:
Given the following information about memory management in C++: ----- The c-runtime dynamic memory manager (and most other commercial memory managers) has issues with fragmentation similar to a...
4
by: Franklin Lee | last post by:
Hi All, I use new to allocate some memory,even I doesn't use delete to release them. When my Application exit, OS will release them. Am I right? If I'm right, how about Thread especally on...
17
by: ~Gee | last post by:
Hi Folks! Please see the program below: 1 #include<iostream> 2 #include<list> 3 #include <unistd.h> 4 using namespace std; 5 int main() 6 { 7 {
2
by: DANIEL BEAULIEU J | last post by:
Basically i am a student taking an operating systems course which is c++ intensive. Familiar with Java, and so not so familiar with memory management. Looking for suggestions of exercises or web...
9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
3
by: beattie.stuart | last post by:
I think I've found a memory leak trying to use the system.management.ManagementObject, but it could be my programming skills so I'd appreciate some advice. I've writing a monitoring routine that...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
5
by: RobbGMelenyk | last post by:
I've got a Windows Service written in C# that is having some unfortunate memory issues. I've been working with .NET MemProfiler and AllocationProfiler. But you don't have to use those programs to...
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". ...
5
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.