473,695 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory grow and out of memory

Hi all,

I have a problem related to memory grow on a server application
which is basically stateless (I have some static info loaded). The
client accesses this server using remoting and it has worked for about
2 years without problems.
The problem I have encountered lately is that the memory on server
side started to grow and not to be released. I have checked first new
functionalities but after isolating these on separate server, the
memory did not grow.
I have also used .Net Memory profiler to find memory leaks on
server and I could not find something that would explain this grows.
With the dump file created with windbg I see that there is memory
allocated of about 10 Mb and the rest 80-120 Mb is occupied by Free
Object (which I understand is the space ready for allocation). These
tests were done on our test environment and not on production so they
may not be conculdent.
Now, the service on production takes up to 600-800 Mb and then I
receive Out Of Memory exception. There physical Memory is about 2 Gb
and this is dedicated server, so it should be able to allocate more
memory. I suspect that the blame is on the memory fragmentation, but I
cannot be sure.
Before posting this, I have checked several issues on this group,
but none of them has helped me so far. I know about the STA and MTA
problem, and I not this :).

The good know is that I have been able to isolate this and I know
that on Windows 2003 is working correctly, and the memory is
deallocated, and the problem I have is on Windows 2000 (sp4 and fwk 1.1
sp1). What is also interesting is that the memory allocation pattern is
like this: first it allocates aprox. 100 Mb, and than stays with this
allocation for about 4h, than allocates another 100 Mb and again it
stays about 4h etc. After 2-3 days I get the out of memory exception.
On the 4h period, I see that memory grows slowly and then decreases to
the same level, but after the next 100Mb allocation, it is never
released.

Does anyone have an explanation for this?

Thanks In Advance,
Florin

Mar 6 '06 #1
3 3755
"Florin" <il************ ***@hotmail.com > wrote

[Out of Memory]
The problem I have encountered lately is that the memory on server
side started to grow and not to be released. I have checked first new
functionalities but after isolating these on separate server, the
memory did not grow.
Sounds like either a classic memory leak or a heap fragmentation issue then.

Are you calling into Win32 or COM on a regular basis?
I have also used .Net Memory profiler to find memory leaks on
server and I could not find something that would explain this grows.
As a quick aside, the SciTech memory profiler is light-years ahead of the
..Net memory profiler. I've done quite a bit of memory analysis for .Net
Server applications, and found this to be by far the best tool.

http://www.scitech.se/memprofiler/
Now, the service on production takes up to 600-800 Mb and then I
receive Out Of Memory exception. There physical Memory is about 2 Gb
and this is dedicated server, so it should be able to allocate more
memory. I suspect that the blame is on the memory fragmentation, but I
cannot be sure.
Have you looked much as the GC performance counters? In which heap is it
saying most of your memory is allocated? Gen2? Large Object?

Other things to think about: Are you running the Workstation or Server CLR?
If you're running the Server CLR (which means you're running on a
Multi-Processor box) you'll see out-of-memory much sooner due to
fragmentation than you would on the workstation version. This is due to the
heaps being divided up for the various processors, so each heap is smaller.
Does anyone have an explanation for this?


It sounds like:
1 - Something is leaking, and it's a classic GC related memory leak. Debug
this with the Scitech tool - run your app, take a snapshot, let it run for a
while longer, take another snapshot. Compare. This will take several hours
and hurt your head.

.... or ...

2 - Many somethings are being pinned in memory causing fragmentation. Debug
this using Son of Strike and WinDebug. The overall problem is discussed
here - https://blogs.msdn.com/yunjin/archiv.../27/63642.aspx

This approach will make you swear and curse, and really, really hurt your
head. Then you'll curse MS for cutting Managed Debugging for Crashdumps out
of VS.Net.

--
Chris Mullins
Mar 6 '06 #2
Hi Chris,

First of all, thank you for posting you reply. I will answer here to
all your questions:
1) I am not using any calls to Win32 or COM.
2) I have used the same application (http://www.scitech.se/memprofiler/
) as you recommended. I know about it, is very good and we bought it.
It has helped us here to find the STA/MTA problem on server side.
Unfortunately it has a defect: I am able to record the calls to the
server, and then replay them. At high load, the .NET Memory Profiler
crashes along with the application is hosting and I cannot use it on
production for example. This time I used it for a set of
functionalities and I could not find and excessive grow. I saw some
bytes[] grow, but not significant (and I am using some statis fields on
server)... I will check them, but with the dump file (according to the
article you gave me). The test I have done with this application where
on win 2003 server, but on this type on OS is working without problem
(I tested this on production - same application, different behavior on
different OS 2000 vs 2003).
3) The counters, yes, I checked them:
- the heap that grows is Gen2, and not large object
- the Private bytes grows in the same time with .NET Bytes in all
Heaps. This suggests managed memory leak/problem. But I could not find
it..
4) I am running in workstation mode. I was planning to suggest server
mode for tests.. So you say is not a good choice..
5) Regarding the memory leak.. I tried, nothing got my attention... And
is working correctly on 2003, so no leaks here. But I will keep
searching.
6) Regarding WinDbg, I made a dump a while ago. I saw only free object
followed by another allocated object. I will try to read it according
to the article you posted.

Also one thing that I not mentioned: Because of some internal
decisions, we are deploying files that are complied in debug mode. I
understand that GC is behaving differently in this situation. Next
builds, I will try to make it as release and see what this brings,
maybe more problems :)...

Thanks for the reply,
Florin

Mar 7 '06 #3
Florin,

I wished I had answers for you. It sounds like a memory leak still, as you
are seeing the Gen2 heap grow without bounds. If you can't debug it with the
SciTech profiler, I'm not sure where to go from here. If you can make the
app crash, the crashdump files will probably be your bes bet - but analyzing
them is hard.

I would open up an MSDN Support incident, (with will cost a few hundred
dollars) and ask them for their help. They'll want a crashdump file (or
two). I've had very positive experiences with the MS folk on a
pay-per-incident basis.

If you're an MSDN Subscriber (Profssional? Universal? Preferred? I can't
keep the new things straight) you are entitled to a few support calls as
part of your subscription.

As to Win32 and Com, sometimes it's not at all obvious. For example, most of
my code is "pure managed code", but I call into the Sockets class. This
causes memory to be pinned while the sockets class in turn calls into Win32
land. My code wasn't doing any Win32 stuff, but under the hood it sure was.

--
Chris Mullins

"Florin" <il************ ***@hotmail.com > wrote in message
news:11******** **************@ z34g2000cwc.goo glegroups.com.. .
Hi Chris,

First of all, thank you for posting you reply. I will answer here to
all your questions:
1) I am not using any calls to Win32 or COM.
2) I have used the same application (http://www.scitech.se/memprofiler/
) as you recommended. I know about it, is very good and we bought it.
It has helped us here to find the STA/MTA problem on server side.
Unfortunately it has a defect: I am able to record the calls to the
server, and then replay them. At high load, the .NET Memory Profiler
crashes along with the application is hosting and I cannot use it on
production for example. This time I used it for a set of
functionalities and I could not find and excessive grow. I saw some
bytes[] grow, but not significant (and I am using some statis fields on
server)... I will check them, but with the dump file (according to the
article you gave me). The test I have done with this application where
on win 2003 server, but on this type on OS is working without problem
(I tested this on production - same application, different behavior on
different OS 2000 vs 2003).
3) The counters, yes, I checked them:
- the heap that grows is Gen2, and not large object
- the Private bytes grows in the same time with .NET Bytes in all
Heaps. This suggests managed memory leak/problem. But I could not find
it..
4) I am running in workstation mode. I was planning to suggest server
mode for tests.. So you say is not a good choice..
5) Regarding the memory leak.. I tried, nothing got my attention... And
is working correctly on 2003, so no leaks here. But I will keep
searching.
6) Regarding WinDbg, I made a dump a while ago. I saw only free object
followed by another allocated object. I will try to read it according
to the article you posted.

Also one thing that I not mentioned: Because of some internal
decisions, we are deploying files that are complied in debug mode. I
understand that GC is behaving differently in this situation. Next
builds, I will try to make it as release and see what this brings,
maybe more problems :)...

Thanks for the reply,
Florin

Mar 7 '06 #4

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

Similar topics

3
2207
by: Vincent | last post by:
Hi I have a problem with pear DB my code : for ($i=0;$i<100000;$i) { $sql = "select id from table where id=x";
19
14843
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2 scsi disks installed on the db box. Sqlserver is set to use max 1,4 GB RAM, and the sqlserver does not seem to be using it all.
5
1634
by: slurper | last post by:
when i do this vector < vector<int> > p; later in the code i do things like this: vector<int> x,y,z; p.push_back(x); p.push_back(y); p.push_back(z);
18
1551
by: Dennis | last post by:
It seems that garbage collection is somewhat flawed in Netscape as the following little script can bring a machine to its knees in about an hour when run on Netstcape 7.1. I've tried freeing the variables manually, but Im not sure whats broken. I assume that the images aren't being freed when they are replaced. Is there a workaround/solution to this? I've read some old postings about this in 4.x browsers, but I never saw a solution, and...
16
2883
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid, or other controls depending on the particular form. This application is setup with one MDI parent calling MDI children with the exception of one Modal form (the report viewer). When I run the application and run one of the screens that pulls...
16
2386
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. Example: After about 5 hours with a concurrent user base of about 150 users the application raises the aspnet_wp memory usage by almost 500MB. If our server guys modify the web.config this data is released and the workerprocess goes back to a...
23
4550
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
2
1421
by: J. Clay | last post by:
Developing in VS 2005 I have WinForm app that utilizes several class objects and is databound to a couple of objects. One of the classes uses a timer to query an in memory database every second for changes (Calls from an external application). I am not sure if this has anything to do with it, but for some reason, the memory usage goes up about 160K just about every second (watching in Task Manager).
17
8469
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML file under linux python 2.4 (same problem with windows 2.5, tried with the first example) : #Python interpreter memory usage : 1.1 Mb private, 1.4 Mb shared #Using http://www.pixelbeat.org/scripts/ps_mem.py to get memory information
0
8619
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
9112
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...
1
8824
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8817
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...
1
6484
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
5831
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
4336
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...
2
2258
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
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.