469,282 Members | 2,000 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Getting Out of memory exception even when the memory is not full

Hi,
I am ruuning to out of memory exception , My system has RAM of 4 GB
and virtual memory paging size set to 4GB .When I check the memory
occupied by the process during the exception , it is less ( around 500
MB and peak Memory usage 800MB , even the total memory of the system
is not high . what are passing use cases where the system leads to out
of memory exception ?
I am using two process for the program and the out of memory occuring
in the second process.

Thanks in Advance

Regards
Aravind

Aug 3 '05 #1
7 18689
Aravind,

How do you know that the memory is not completly used.

Cor
Aug 3 '05 #2
Aravind <ar*************@gmail.com> wrote:
I am ruuning to out of memory exception , My system has RAM of 4 GB
and virtual memory paging size set to 4GB .When I check the memory
occupied by the process during the exception , it is less ( around 500
MB and peak Memory usage 800MB , even the total memory of the system
is not high . what are passing use cases where the system leads to out
of memory exception ?
I am using two process for the program and the out of memory occuring
in the second process.


There are other situations in which you can get an
OutOfMemoryException, I believe - if you "leak" a lot of Windows
handles, for instance, I think you can get that exception. The most
common cause of this in my experience is using large numbers of images
and not disposing of them. Could that be the problem?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Aug 3 '05 #3
Jon,

In my opinion it is easier to get an Out of memory exception with code like
beneath.

\\\\
Public Class Main
Public Shared Sub main()
Dim a As New Main
End Sub
Public Sub New()
Dim c As New ArrayList
For i As Integer = 0 To 999999999
c.Add(c)
Next
Dim b As New Main
End Sub
End Class
///

I made this because that I was curious what the taskmanager would do with
this.

Cor
Aug 3 '05 #4
Aravind,
Another way to run out of memory without using much is to create too
many threads. Since each thread normally reserves 1 meg of memory space,
creating 2000 threads will reserve all of available user memory while
actually only consuming about 10 Meg.
Bob Milton

"Aravind" <ar*************@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi,
I am ruuning to out of memory exception , My system has RAM of 4 GB
and virtual memory paging size set to 4GB .When I check the memory
occupied by the process during the exception , it is less ( around 500
MB and peak Memory usage 800MB , even the total memory of the system
is not high . what are passing use cases where the system leads to out
of memory exception ?
I am using two process for the program and the out of memory occuring
in the second process.

Thanks in Advance

Regards
Aravind

Aug 3 '05 #5
Hi Cor,

When I check the memory occupied by the task manager , the process is
not occupying huge memory ( around 500
MB and peak Memory usage 800MB ) for my RAM 4GB . Hence I had the
confusion.

When the process is reaching out of memory it should show the memory
usage of the process in the task manager right ?

Regards
Aravind.
*** Sent via Developersdex http://www.developersdex.com ***
Aug 3 '05 #6
Please don't multipost, I replied in the Csharp NG.

Willy.

"Aravind" <ar*************@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi,
I am ruuning to out of memory exception , My system has RAM of 4 GB
and virtual memory paging size set to 4GB .When I check the memory
occupied by the process during the exception , it is less ( around 500
MB and peak Memory usage 800MB , even the total memory of the system
is not high . what are passing use cases where the system leads to out
of memory exception ?
I am using two process for the program and the out of memory occuring
in the second process.

Thanks in Advance

Regards
Aravind

Aug 3 '05 #7
> When I check the memory occupied by the task manager , the process is
not occupying huge memory ( around 500
MB and peak Memory usage 800MB ) for my RAM 4GB . Hence I had the
confusion.

When the process is reaching out of memory it should show the memory
usage of the process in the task manager right ?

No,

However I saw that Willy has answered you in the Csharp newsgroup. He is a
kind of the specialist in this kind of questions.

In addition to him please don't multipost, crossposting to the dotnet
newsgroups is if done well not a problem at all.

Cor
Aug 4 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Liverpool fan | last post: by
81 posts views Thread by Peter Olcott | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.