Results 1 to 13 of 13

Thread: Annoying error

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    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.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    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.

  4. #4

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    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%

  6. #6

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    Re: Annoying error

    Because you said that the RAM could be the problem.
    I have a 1 TB hard-disk..

  8. #8
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    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)

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    14

    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#

  10. #10
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Annoying error

    Quote Originally Posted by ovenicolai View Post
    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)

  11. #11
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    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.

  12. #12
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    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.

  13. #13
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    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
  •  



Click Here to Expand Forum to Full Width