473,796 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CLR Memory Utilisation

I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each iteration thread sleeping for 5 seconds and than reading textual message files from a Windows Folder and applying them to a database.
From an external view, the server appears to have a memory-leek, continuously consuming RAM in a near linier fashion as it runs. I’ve observed the following
• Monitoring the application with perfmon or the windows task manager, the application continuously consumes additional memory at the rate of about half a gigabyte an hour.
• Viewed internally using GC.GetTotalMemo ry(true), memory consumption fluctuates between 400 and 800 KB and exhibits no trend of increasing memory utilisation.
• Fireing up another application under the .NET environment causes the near linier increase in memory utilisation to de-stabilise and occasionally drop dramatically. The most extreme observed drop was from 1.5GB to just under 1 megabyte
I have tried the application on Windows NT4, 2000 and XP running it under .NET without service packs and separately with service pack 1 and with service pack 2. In each case I’ve seen the same behaviour

Is this known CLR behaviour? Is there any way of restricting the amount of memory available to the CLR

Any thoughts or info would be greatly received. I have an angry client who want’s to move back to J2EE :

Jul 21 '05 #1
11 2809
Hi Jong,

Interesting, what happens when the thread awakes, are you creating "new"
objects while the method never ends?

Just a thought

Cor
Jul 21 '05 #2
Hi Jong,

Interesting, what happens when the thread awakes, are you creating "new"
objects while the method never ends?

Just a thought

Cor
Jul 21 '05 #3
What memory perf. counter shows the increased memory consumption?
If it's not a CLR memory counter, and I assume it's not, you probaly have a
non CLR memory leak.
Did you ever try to attach a debugger to the process?
What version of the framework do you run this on?
What OS and DB versions?

Willy.

"jo**@opentext. com" <an*******@disc ussions.microso ft.com> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
I have a problem with an C# application. The application is a 24x7 low
volume message processing server. The server has a single thread of
processing, running in a continuous loop, for each iteration thread
sleeping for 5 seconds and than reading textual message files from a
Windows Folder and applying them to a database.
From an external view, the server appears to have a memory-leek,
continuously consuming RAM in a near linier fashion as it runs. I’ve
observed the following:
• Monitoring the application with perfmon or the windows task manager, the
application continuously consumes additional memory at the rate of about
half a gigabyte an hour.
• Viewed internally using GC.GetTotalMemo ry(true), memory consumption
fluctuates between 400 and 800 KB and exhibits no trend of increasing
memory utilisation.
• Fireing up another application under the .NET environment causes the
near linier increase in memory utilisation to de-stabilise and
occasionally drop dramatically. The most extreme observed drop was from
1.5GB to just under 1 megabyte.
I have tried the application on Windows NT4, 2000 and XP running it under
.NET without service packs and separately with service pack 1 and with
service pack 2. In each case I’ve seen the same behaviour.

Is this known CLR behaviour? Is there any way of restricting the amount
of memory available to the CLR?

Any thoughts or info would be greatly received. I have an angry client
who want’s to move back to J2EE :(

Jul 21 '05 #4
What memory perf. counter shows the increased memory consumption?
If it's not a CLR memory counter, and I assume it's not, you probaly have a
non CLR memory leak.
Did you ever try to attach a debugger to the process?
What version of the framework do you run this on?
What OS and DB versions?

Willy.

"jo**@opentext. com" <an*******@disc ussions.microso ft.com> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
I have a problem with an C# application. The application is a 24x7 low
volume message processing server. The server has a single thread of
processing, running in a continuous loop, for each iteration thread
sleeping for 5 seconds and than reading textual message files from a
Windows Folder and applying them to a database.
From an external view, the server appears to have a memory-leek,
continuously consuming RAM in a near linier fashion as it runs. I’ve
observed the following:
• Monitoring the application with perfmon or the windows task manager, the
application continuously consumes additional memory at the rate of about
half a gigabyte an hour.
• Viewed internally using GC.GetTotalMemo ry(true), memory consumption
fluctuates between 400 and 800 KB and exhibits no trend of increasing
memory utilisation.
• Fireing up another application under the .NET environment causes the
near linier increase in memory utilisation to de-stabilise and
occasionally drop dramatically. The most extreme observed drop was from
1.5GB to just under 1 megabyte.
I have tried the application on Windows NT4, 2000 and XP running it under
.NET without service packs and separately with service pack 1 and with
service pack 2. In each case I’ve seen the same behaviour.

Is this known CLR behaviour? Is there any way of restricting the amount
of memory available to the CLR?

Any thoughts or info would be greatly received. I have an angry client
who want’s to move back to J2EE :(

Jul 21 '05 #5
Yes Cor

I'm creating new objects within methods called by my infinite loop. However, these objects are transitory and are de-referenced immediately after use (before the completion of a sleep / processing cycle).

Thanks for the thought.

Cheers
Jg.

Jul 21 '05 #6
Hi Will

I was using Process/Virtual Bytes focused on my .Net application process. I originally had a view that I had a memory-leak issue however I found that fireing up another application under the .NET environment causes the near linier increase in memory utilisation to de-stabilise and occasionally drop dramatically. This only occurred when running another .Net application which lead me to believe that the memory utilization was not directly due to my application. My assumption/guess currently is that, in some situations, the CLR can be lazy in returning memory to the O/S and when a competing .Net application is fired up that needs this memory it simply passes the free memory over to the competing application
I have tried the application on multiple O/S installs - Windows NT4 SP6, 2000 SP4 and XP. If have also run it under .NET 1.0 and separately with service packs 1 and 2. In each case I’ve seen the same behavior
All very odd

The memory utilization would not be a problem if I could cap the amount of memory available to the CLR (like you can limit the amount of heap space available to a Java VM). Are you or any one else aware of any way of achieving this

Thank

Jg
----- Willy Denoyette [MVP] wrote: ----

What memory perf. counter shows the increased memory consumption
If it's not a CLR memory counter, and I assume it's not, you probaly have a
non CLR memory leak
Did you ever try to attach a debugger to the process
What version of the framework do you run this on
What OS and DB versions

Willy

"jo**@opentext. com" <an*******@disc ussions.microso ft.com> wrote in message
news:0F******** *************** ***********@mic rosoft.com..
I have a problem with an C# application. The application is a 24x7 low
volume message processing server. The server has a single thread of
processing, running in a continuous loop, for each iteration thread
sleeping for 5 seconds and than reading textual message files from a
Windows Folder and applying them to a database
From an external view, the server appears to have a memory-leek,
continuously consuming RAM in a near linier fashion as it runs. I’ve
observed the following
• Monitoring the application with perfmon or the windows task manager, the
application continuously consumes additional memory at the rate of about
half a gigabyte an hour
• Viewed internally using GC.GetTotalMemo ry(true), memory consumption
fluctuates between 400 and 800 KB and exhibits no trend of increasing
memory utilisation
• Fireing up another application under the .NET environment causes the
near linier increase in memory utilisation to de-stabilise and
occasionally drop dramatically. The most extreme observed drop was from
1.5GB to just under 1 megabyte
I have tried the application on Windows NT4, 2000 and XP running it under
.NET without service packs and separately with service pack 1 and with
service pack 2. In each case I’ve seen the same behaviour
Is this known CLR behaviour? Is there any way of restricting the amount

of memory available to the CLR
Any thoughts or info would be greatly received. I have an angry client

who want’s to move back to J2EE :

Jul 21 '05 #7
Hi Jong,

I think that setting them to nothing does nothing for your memory.
In this case you have to dispose them in my opinion

What are you doing?

Cor
Jul 21 '05 #8
Hi Cor, thanks for your response

My understanding was that the GC disposes the object automatically at it’s next opportunity once an object is de-referenced. An excerpt from my code is as follows

protected void LoaderLoop(

â€
while (true) // Forever! :

â€
bRet = CheckForNew(sLo cation, xSourceConfig, xTargetConfig)
â€
Thread.Sleep(in terval)
â€

â€
public bool CheckForNew(Str ing sPath, XmlNode xSourceConfig, XmlNode xTargetConfig

XMLUtilities oUtil
â€
oUtil = new XMLUtilities()
â€
sPrefix = oUtil.GetXMLVal ue(xSourceConfi g,"FILEPREFIX ")
â€
LoaderLoop() Iterates forever sleeping and calling CheckForNew(). CheckForNew() declares variables for a number of objects upfront (oUtil for example in the excerpt) and is passed a number of objects by value. At the end of CheckForNew() despose is not manually called for any of the created objects. The method simply returns (or is aborted due to an exception). The assumption is that the objects created in the arguments (that are not passed by reference) and the objects explicitly created and referenced by local variables in the method body are automatically dereference because referring variable have gone out of scope on method exit leaving the dereferenced object to be garbage collected. My understanding is that there is no need in the code to explicitly call the c# depose equivalent to destructors (?)

Jo

Jul 21 '05 #9
Hi Cor, thanks for your response

My understanding was that the GC disposes the object automatically at it’s next opportunity once an object is de-referenced. An excerpt from my code is as follows

protected void LoaderLoop(

â€
while (true) // Forever! :

â€
bRet = CheckForNew(sLo cation, xSourceConfig, xTargetConfig)
â€
Thread.Sleep(in terval)
â€

â€
public bool CheckForNew(Str ing sPath, XmlNode xSourceConfig, XmlNode xTargetConfig

XMLUtilities oUtil
â€
oUtil = new XMLUtilities()
â€
sPrefix = oUtil.GetXMLVal ue(xSourceConfi g,"FILEPREFIX ")
â€
LoaderLoop() Iterates forever sleeping and calling CheckForNew(). CheckForNew() declares variables for a number of objects upfront (oUtil for example in the excerpt) and is passed a number of objects by value. At the end of CheckForNew() despose is not manually called for any of the created objects. The method simply returns (or is aborted due to an exception). The assumption is that the objects created in the arguments (that are not passed by reference) and the objects explicitly created and referenced by local variables in the method body are automatically dereference because referring variable have gone out of scope on method exit leaving the dereferenced object to be garbage collected. My understanding is that there is no need in the code to explicitly call the c# depose equivalent to destructors (?)

Jo

Jul 21 '05 #10

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

Similar topics

5
2643
by: iceColdFire | last post by:
Hi, I am writing some hybrid application s using C/C++ modules together....Here I have created and used a lot of malloc(...) and new(...) operators. I am interested in checking on the optimisation part of the programs...like memory consumed,memory leak , processor utilisation and like...most of the info I got from task manager...however still I cand find way to check on memory leaks...
0
1324
by: Bruce Pullen | last post by:
DB27.2 on AIX 5.2. KEEPDARI = YES MAXDARI = 50 I'm investigating memory paging caused, I believe, by a specific memory-hungry stored procedure and have some questions! 1) Is there a memory pool/limit that is associated with the DARI processes? 2) Do the DARI processes continue to grab physical memory until the
10
373
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each iteration thread sleeping for 5 seconds and than reading textual message files from a Windows Folder and applying them to a database. From an external view, the server appears to have a memory-leek, continuously consuming RAM in a near linier fashion as...
0
892
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each iteration thread sleeping for 5 seconds and than reading textual message files from a Windows Folder and applying them to a database. From an external view, the server appears to have a memory-leek, continuously consuming RAM in a near linier fashion as...
0
9679
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
9527
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9050
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...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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();...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4115
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
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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.