473,799 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Recycling

Hi,
I want to have in a application i have created the feature of application
recycling,
similar to the aspnet_wp, and the new COM+ service.
The reason i want to do this is because of being able to set limits to the
memory usage my app
can consume, and recycling it when it exceeds this limit.
What I have done so far, is to create an application domain, in which all
the objects i use are created,
and by defining a certain number of method calls, or a memory threshold, i
unload this domain and load
it again rigtht after.
However, because i use a number of threads in the app, i have to write code
that unloads the application domain,
only when all the created threads have finished their work, and pausing of
course the creation of new ones.
The threads i use, come from a timer
Until no i have some satisfactory results, but i would like to here some
more ideas, if any one has the time

Thanks
Nov 15 '05 #1
6 2937
Marios,

Unloading an application domain won't do anything for you in this case I
believe. The GC and the managed heap extends across all application domains
in the process. So even if you shut down one application domain, you won't
reclaim the memory that you think is leaking (which it probably isn't).

--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:e9******** ********@tk2msf tngp13.phx.gbl. ..
Hi,
I want to have in a application i have created the feature of application
recycling,
similar to the aspnet_wp, and the new COM+ service.
The reason i want to do this is because of being able to set limits to the
memory usage my app
can consume, and recycling it when it exceeds this limit.
What I have done so far, is to create an application domain, in which all
the objects i use are created,
and by defining a certain number of method calls, or a memory threshold, i
unload this domain and load
it again rigtht after.
However, because i use a number of threads in the app, i have to write code that unloads the application domain,
only when all the created threads have finished their work, and pausing of
course the creation of new ones.
The threads i use, come from a timer
Until no i have some satisfactory results, but i would like to here some
more ideas, if any one has the time

Thanks

Nov 15 '05 #2
Nicholas
thank u for your answer.
However i have noticed that whenever i unload the custom domain i create,
the memory the application consumes is reduced.
Anyway, if that does not work 100% satisfactory, i am thinking of creating
custom processes and terminating these.
Do u have any other suggestion ?

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:e1******** ******@tk2msftn gp13.phx.gbl...
Marios,

Unloading an application domain won't do anything for you in this case I believe. The GC and the managed heap extends across all application domains in the process. So even if you shut down one application domain, you won't reclaim the memory that you think is leaking (which it probably isn't).

--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:e9******** ********@tk2msf tngp13.phx.gbl. ..
Hi,
I want to have in a application i have created the feature of application recycling,
similar to the aspnet_wp, and the new COM+ service.
The reason i want to do this is because of being able to set limits to the memory usage my app
can consume, and recycling it when it exceeds this limit.
What I have done so far, is to create an application domain, in which all the objects i use are created,
and by defining a certain number of method calls, or a memory threshold, i unload this domain and load
it again rigtht after.
However, because i use a number of threads in the app, i have to write

code
that unloads the application domain,
only when all the created threads have finished their work, and pausing of course the creation of new ones.
The threads i use, come from a timer
Until no i have some satisfactory results, but i would like to here some
more ideas, if any one has the time

Thanks


Nov 15 '05 #3
Marios,

I still don't understand why you are doing it. I would be less worried
about the memory consumption on the machine and more concerned about whether
or not the application is performing correctly and in a performant manner
(the memory consumed does not indicate that it is NOT performant).

What you are seeing is natural for a GC system.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Nicholas
thank u for your answer.
However i have noticed that whenever i unload the custom domain i create,
the memory the application consumes is reduced.
Anyway, if that does not work 100% satisfactory, i am thinking of creating
custom processes and terminating these.
Do u have any other suggestion ?

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote in message news:e1******** ******@tk2msftn gp13.phx.gbl...
Marios,

Unloading an application domain won't do anything for you in this case
I
believe. The GC and the managed heap extends across all application domains
in the process. So even if you shut down one application domain, you

won't
reclaim the memory that you think is leaking (which it probably isn't).

--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:e9******** ********@tk2msf tngp13.phx.gbl. ..
Hi,
I want to have in a application i have created the feature of

application recycling,
similar to the aspnet_wp, and the new COM+ service.
The reason i want to do this is because of being able to set limits to the memory usage my app
can consume, and recycling it when it exceeds this limit.
What I have done so far, is to create an application domain, in which all the objects i use are created,
and by defining a certain number of method calls, or a memory threshold, i
unload this domain and load
it again rigtht after.
However, because i use a number of threads in the app, i have to write code
that unloads the application domain,
only when all the created threads have finished their work, and
pausing of course the creation of new ones.
The threads i use, come from a timer
Until no i have some satisfactory results, but i would like to here

some more ideas, if any one has the time

Thanks



Nov 15 '05 #4
Nicholas,
the reason i want to do this is simple.
I have created a windows service with a timer , and another one with a
simple file system event watcher.
Although i properly dispose all the objects that i use, i have even
commented the code running inside the event,
at every event execution an additional amount of memory is kept, and the
thing is that the memory allocation
is never reduced. That had a simple effect. It has finally allocated a very
large number of megabytes in RAM, in
a production server that made the service simply not acceptable by the
client.
That is why i want to be able to do this, so that it will not happen again.
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:us******** ******@TK2MSFTN GP12.phx.gbl...
Marios,

I still don't understand why you are doing it. I would be less worried about the memory consumption on the machine and more concerned about whether or not the application is performing correctly and in a performant manner
(the memory consumed does not indicate that it is NOT performant).

What you are seeing is natural for a GC system.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Nicholas
thank u for your answer.
However i have noticed that whenever i unload the custom domain i create,
the memory the application consumes is reduced.
Anyway, if that does not work 100% satisfactory, i am thinking of creating custom processes and terminating these.
Do u have any other suggestion ?

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com>

wrote
in message news:e1******** ******@tk2msftn gp13.phx.gbl...
Marios,

Unloading an application domain won't do anything for you in this case
I
believe. The GC and the managed heap extends across all application

domains
in the process. So even if you shut down one application domain, you

won't
reclaim the memory that you think is leaking (which it probably isn't).
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:e9******** ********@tk2msf tngp13.phx.gbl. ..
> Hi,
> I want to have in a application i have created the feature of

application
> recycling,
> similar to the aspnet_wp, and the new COM+ service.
> The reason i want to do this is because of being able to set limits to the
> memory usage my app
> can consume, and recycling it when it exceeds this limit.
> What I have done so far, is to create an application domain, in
which all
> the objects i use are created,
> and by defining a certain number of method calls, or a memory

threshold,
i
> unload this domain and load
> it again rigtht after.
> However, because i use a number of threads in the app, i have to

write code
> that unloads the application domain,
> only when all the created threads have finished their work, and

pausing
of
> course the creation of new ones.
> The threads i use, come from a timer
> Until no i have some satisfactory results, but i would like to here

some > more ideas, if any one has the time
>
> Thanks
>
>



Nov 15 '05 #5
Marios,

That's the thing, this is SUPPOSED to happen. The CLR is going to try
and consume resources until it deems that it should give them back. It is
the CLR's business to manage this. This is why they call it "managed
memory".
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Nicholas,
the reason i want to do this is simple.
I have created a windows service with a timer , and another one with a
simple file system event watcher.
Although i properly dispose all the objects that i use, i have even
commented the code running inside the event,
at every event execution an additional amount of memory is kept, and the
thing is that the memory allocation
is never reduced. That had a simple effect. It has finally allocated a very large number of megabytes in RAM, in
a production server that made the service simply not acceptable by the
client.
That is why i want to be able to do this, so that it will not happen again.

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote in message news:us******** ******@TK2MSFTN GP12.phx.gbl...
Marios,

I still don't understand why you are doing it. I would be less worried
about the memory consumption on the machine and more concerned about

whether
or not the application is performing correctly and in a performant manner
(the memory consumed does not indicate that it is NOT performant).

What you are seeing is natural for a GC system.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Nicholas
thank u for your answer.
However i have noticed that whenever i unload the custom domain i create, the memory the application consumes is reduced.
Anyway, if that does not work 100% satisfactory, i am thinking of creating custom processes and terminating these.
Do u have any other suggestion ?

"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com>

wrote
in message news:e1******** ******@tk2msftn gp13.phx.gbl...
> Marios,
>
> Unloading an application domain won't do anything for you in this case
I
> believe. The GC and the managed heap extends across all application
domains
> in the process. So even if you shut down one application domain,
you won't
> reclaim the memory that you think is leaking (which it probably isn't). >
> --
> - Nicholas Paldino [.NET/C# MVP]
> - ni************* *@exisconsultin g.com
>
> "Marios" <m.********** @k-netgroup.com> wrote in message
> news:e9******** ********@tk2msf tngp13.phx.gbl. ..
> > Hi,
> > I want to have in a application i have created the feature of
application
> > recycling,
> > similar to the aspnet_wp, and the new COM+ service.
> > The reason i want to do this is because of being able to set
limits to the
> > memory usage my app
> > can consume, and recycling it when it exceeds this limit.
> > What I have done so far, is to create an application domain, in which all
> > the objects i use are created,
> > and by defining a certain number of method calls, or a memory

threshold,
i
> > unload this domain and load
> > it again rigtht after.
> > However, because i use a number of threads in the app, i have to write > code
> > that unloads the application domain,
> > only when all the created threads have finished their work, and

pausing
of
> > course the creation of new ones.
> > The threads i use, come from a timer
> > Until no i have some satisfactory results, but i would like to

here some
> > more ideas, if any one has the time
> >
> > Thanks
> >
> >
>
>



Nov 15 '05 #6
Nicholas,

The GC does a full garbage collection when it unloads an appdomain, so the
resources used in an appdomain should be reclaimed when it is unloaded.
There currently is a small memory leak (about 12 bytes) per unloaded
appdomain.

Dave
PS: Full disclosure - info based on Chris Brumme's most excellent blog.
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:e1******** ******@tk2msftn gp13.phx.gbl...
Marios,

Unloading an application domain won't do anything for you in this case I believe. The GC and the managed heap extends across all application domains in the process. So even if you shut down one application domain, you won't reclaim the memory that you think is leaking (which it probably isn't).

--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Marios" <m.********** @k-netgroup.com> wrote in message
news:e9******** ********@tk2msf tngp13.phx.gbl. ..
Hi,
I want to have in a application i have created the feature of application recycling,
similar to the aspnet_wp, and the new COM+ service.
The reason i want to do this is because of being able to set limits to the memory usage my app
can consume, and recycling it when it exceeds this limit.
What I have done so far, is to create an application domain, in which all the objects i use are created,
and by defining a certain number of method calls, or a memory threshold, i unload this domain and load
it again rigtht after.
However, because i use a number of threads in the app, i have to write

code
that unloads the application domain,
only when all the created threads have finished their work, and pausing of course the creation of new ones.
The threads i use, come from a timer
Until no i have some satisfactory results, but i would like to here some
more ideas, if any one has the time

Thanks


Nov 15 '05 #7

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

Similar topics

3
4310
by: Grinninger | last post by:
Hello, I am using ASP.NET, C# under W2K. I try to keep some important information in application- and session-state Objects. With the recycling of the ASPNet_WP.EXE my application- and session-state Objects get lost. Therfore I have some questions: -) Is it usual that the ASPNet_WP.EXE becomes recycled twice a day? -) What is the expected recyclingperiod for the ASPNet_WP.EXE ?
4
1989
by: Hari Koduru | last post by:
Hi All, I am getting the following exception in an ASP.NET application. Exception Details: System.InvalidOperationException: Application is restarting. I have been to the following Support page
2
1394
by: Andriy Gnennyy | last post by:
Hello everyone, We have large and complex ASP.Net web application. Eventually IIS recycles our application due to deadlock condition. The error message in the event log looks like this: --------------------------------------------- Event Type: Error Event Source: ASP.NET 1.0.3705.288 Event Category: None
2
2100
by: Lars Netzel | last post by:
Hi We have an ASP.NET application running on a Live server and we have had some problems with the Application pool beeing recycled due to heavy load on the server. The load is really not that bad and this should nto occur. The application is using a lot of Session varaibles but I have no idea if this is a problem. I need the session variabled to make passing varibles between pages more secure. We also have many Datasets in the session. ...
6
1501
by: Chase | last post by:
I'm pretty new to asp.net and am having problems with my application timing out. I've written an application that loops through all of the information on an excel spreadsheet and does certain things with it, like creating and configuring WSS sites. My application runs fine for approximately 25 minutes, then I get the 'Page cannot be displayed' error. It seems like my browser times out before the application can finish what its doing.
2
1965
by: James Hunter Ross | last post by:
Friends, We have been experiencing unexpected Application Timeout issues in our ASP 1.1 application. We eventually read-up on aspnet_wp (or w3wp) "recycling" and various related concepts configuration settings. I did a post here Thursday and a response from "JIMCO Software" gave us clues about "Application Restarts" and an associated PerfMon counter we could use to monitor restarts. After watching the PerfMon counter, it turns out...
6
4463
by: Wayne Smith | last post by:
Hi, We are having a few problems with ASP.Net pages hanging during load when an Application Pool is recycled. To test this we have setup the following ASP.net page which refreshes every 2 seconds: <%@ Page language="c#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.IO" %>
2
3963
by: HLady | last post by:
I have a sequence of clicks in my apps that are always causing the session to start again. This is definitely not being caused by a timeout, cause it always happens no matter how long since the last load. It is happening right after a this.Response.Redirect(myURL+ querystring). This line of code is executed in other areas fine, so nothing wrong with the actual line, but I always get a session_start event right after this is executed after...
4
2160
by: Alex | last post by:
Hello, This is a follow-up to my earlier post about having issues with our application pool recycling. We currently use Session State InProc, but if I were to choose to move the existing application to SQL instead, would the only change in the application be the SessionState setting within web.config? I know I'd also need to setup our MS SQL database to handle sessions (detailed in MS Article 317604), but outside of this, is there...
0
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10268
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10031
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.