|
-
Mar 9th, 2011, 06:25 AM
#1
Thread Starter
New Member
Annoying error
Hi. 
Every-time I debug a program after I work on it for about 20 minutes i get this error 3 times :
Exception of type 'System.OutOfMemoryException' was throw.
I am not a professional, just a hobby programmer, so i have no idea what it means. Please help me.
It does not prevent me from debugging, just that the program that I debug is not the same as it was when i pressed debug, its a "earlier" version of it.
It's not C sharp, its .NET, forgot to do that..
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Last edited by ovenicolai; Mar 9th, 2011 at 06:30 AM.
-
Mar 9th, 2011, 06:41 AM
#2
Re: Annoying error
OutOfMemory usually means exactly that - your don't have enough RAM to continue.
What exactly your program does?
-
Mar 9th, 2011, 06:55 AM
#3
Thread Starter
New Member
Re: Annoying error
I got a brand new iMac with Windows partitioned on the same disk.
The program is just a start of something, so it contains 3 panels, thats it.
-
Mar 9th, 2011, 06:59 AM
#4
Re: Annoying error
When the exception is thrown?
-
Mar 9th, 2011, 07:02 AM
#5
Thread Starter
New Member
Re: Annoying error
Yeah, well the Actual program(or the newest) has backcolors in the panels, and two PictureBox'es..
I monitored the CPU usage when i ran the program, but it only, at max, reached 40%
-
Mar 9th, 2011, 07:32 AM
#6
Re: Annoying error
How the CPU usage can be related to out of memory error?
I asked at what line of code the exception is thrown?
-
Mar 9th, 2011, 10:03 AM
#7
Thread Starter
New Member
Re: Annoying error
Because you said that the RAM could be the problem.
I have a 1 TB hard-disk..
-
Mar 9th, 2011, 11:59 AM
#8
Re: Annoying error
Hard drive does not equal RAM.
Please post the offending code so we can help you.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Mar 9th, 2011, 02:28 PM
#9
Thread Starter
New Member
Re: Annoying error
I know the difference between RAM and a harddrive.
There is no code to the project, I've only designed the project.
And once again its "written" in Visual Studio 2010 .NET, Not in C#
-
Mar 9th, 2011, 02:30 PM
#10
Re: Annoying error
 Originally Posted by ovenicolai
Because you said that the RAM could be the problem.
I have a 1 TB hard-disk..
I disagree. You seem to think they're the same.
For the record, C# is a language. .Net is an architecture and Visual Studio is an IDE. You could be in all three at once, or none. Or something in between.
Last edited by Lord_Rat; Mar 9th, 2011 at 02:38 PM.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Mar 9th, 2011, 07:01 PM
#11
Re: Annoying error
How quaint the notion is that OutOfMemoryException has anything to do with the amount of RAM you have.
In fact, ovenicolai was closer by posting how much disk he has, since the memory allocated to a process is better imagined as a huge file on disk. A process can allocate as much memory as there is disk space for [edit: free disk space, obviously], and the OS will swap it in and out of RAM. RAM than acts as a small but fast cache for the disk*.
Okay, so the actual problem with an OutOfMemoryException is running out of addressable memory. This can happen if you fill up 2GB of memory on 32-bit hardware. It can also happen if that 2GB of memory gets fragmented so there is not sufficient continuous free-space in memory to allocate what you've just requested.
On 64 bit hardware with 32 bit windows, you can address up to 3GB. On 64 bit hardware with 64 bit windows and a 32 bit process you can address up to 4GB [Edit: with the 32 bit process being Large Address Aware and a special switch on the .NET framework]. With a 64 bit process you can address ... err lots.
Okay, so I'm assuming that we're running on 32 bit hardware here. The next question is what's throwing the OOM? If it's your application, then you've got a memory leak. In managed code, this generally is caused by holding references to things you don't actually need anymore so Garbage Collection can't free the memory. It's hard to say where you should start looking because frankly it could be anywhere in your code and it isn't a single line that's causing the problem.
*In future OSes I suspect we can start thinking of the disk as a faster but smaller cache for the cloud, and we'll be able to allocate as much memory as we can get from the Internet.
Last edited by Evil_Giraffe; Mar 9th, 2011 at 07:10 PM.
-
Mar 9th, 2011, 07:04 PM
#12
Re: Annoying error
Oh, also note the difference between allocating memory and addressing memory. .NET doesn't supply it out of the box, but it's perfectly possible to allocate more memory than you can address and swap it in and out of the addressable range. That's... really tricky, and another topic entirely.
-
Mar 9th, 2011, 11:23 PM
#13
Re: Annoying error
While I understand the concept of swap, then you must understand that whatever swap is configured is also pre-sized. It doesn't dynamically grow (on windows anyway) (after XP - before then you could set it to dynamically grow).
So that's clearly not the problem and not really at all related.
What I'm wondering is why if he's so sure it's not a c# application did he post this in a c# forum?
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|