472,328 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Exception of type System.OutOfMemoryException was thrown.

Exception of type System.OutOfMemoryException was thrown.

this error is occuring when on arbitrary threads in my .net windows service.
There is 2 gigs of memory on the machine and this .net windows service only
uses 50 megabytes. What could be causing this? how to fix?
Feb 24 '06 #1
4 47606
Daniel,

I've seen OutOfMemory exceptions thrown when the problem is completely
different. For example Graphics.DrawLine throws this exception and obviously
there is no memory issue. I'd suggest to debug the code and find out what
the real reason for that might be.
"Daniel" <so*******************@yahoo.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
Exception of type System.OutOfMemoryException was thrown.

this error is occuring when on arbitrary threads in my .net windows
service.
There is 2 gigs of memory on the machine and this .net windows service
only
uses 50 megabytes. What could be causing this? how to fix?

Feb 24 '06 #2

You can run out of memory if your application is not releasing pinned
memory blocks because the garbage collector only frees memory up to the
first pinned block. Aka if your application pins some memory, then
allocates heap space, then pins more memory, then allocates more heap
space - eventually you will have memory issues because the last pinned
block will "slide" down the heap leaving less and less free space to a
point where an allocation request fails...

You can check your heap usage with perfmon and the .NET memory & GC
performance counters; this will tell you if the out of memory exception
is a red herring or not. If it is a real out of memory condition then
you can use CLRProfiler {free download from msdn website} to see heap
usage in detail...

Also, if it is a real out of memory condition, then in code you might
look for:

- Assure that any class that implements the IDisposable interface is
wrapped in a "using" statement block or else is explicitly disposed in
a finally block

- Assure that pinned {fixed in C#} objects are going out of scope in a
timely manner

- For v1.x of .NET, assure that any COM Interop RCW classes are
explicitly freed with Marshal.ReleaseCOMObject()

Feb 24 '06 #3

"Crash" <so*********@san.rr.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com...
|
| You can run out of memory if your application is not releasing pinned
| memory blocks because the garbage collector only frees memory up to the
| first pinned block. Aka if your application pins some memory, then
| allocates heap space, then pins more memory, then allocates more heap
| space - eventually you will have memory issues because the last pinned
| block will "slide" down the heap leaving less and less free space to a
| point where an allocation request fails...
|

Not true, pinning only prevents compactation of the heaps (managed) that
means that memory consumption grows while large blocks of the heap aren't
used to contain live objects, but the memory consumption grows! which is not
the case here (50MB used).

Willy.
Feb 25 '06 #4

"Daniel" <so*******************@yahoo.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
| Exception of type System.OutOfMemoryException was thrown.
|
| this error is occuring when on arbitrary threads in my .net windows
service.
| There is 2 gigs of memory on the machine and this .net windows service
only
| uses 50 megabytes. What could be causing this? how to fix?
|
|

Please be more specific - What memory? How did you measure, what are you
doing in this Service, you aren't using System.Drawing namespace classes do
you?

Willy.
Feb 25 '06 #5

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

Similar topics

1
by: Ripul Handa | last post by:
Hi We are running IIS 5.0 cluster with cisco local director. We are running a website on 2 webservers and I have been observing that from past...
1
by: SMG - Idealake | last post by:
Hi all, I am getting following error on my error, what could be the reason? Exception of type System.OutOfMemoryException was thrown....
5
by: karups | last post by:
Hi, There are several pages that occasionally start throwing System.OutOfMemoryException and "The type initializer for...
8
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the...
16
by: Lamont Sanford | last post by:
I can't figure out why once or twice per week, my C# server application throws OutOfMemoryExceptions. There is plenty of memory in the machine. As...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.