|
-
Jan 24th, 2011, 02:54 PM
#1
Thread Starter
Junior Member
System.OutOfMemoryException
Hello i have written a program in vb.net of about 550 lines and consists of 15 forms till now but the program is not completed yet. Each time i add a new form and when i save it i get 'System.OutOfMemoryException was thrown'. I used to close vb.net and open it again then it would work fine but now i'm getting this exception even if i do so. I have 66 GB free space available in my hard disk can't understand why i'm gettin this exception. Can someone please give me any suggestions?
Thanks...
-
Jan 24th, 2011, 03:02 PM
#2
Re: System.OutOfMemoryException
You are getting this when you are saving or opening the solution, not during debugging, right? That number of forms is trivial, in itself. Is there anything unusual about the forms? Are you using lots of resources (especially images) in the project?
My usual boring signature: Nothing
 
-
Jan 24th, 2011, 03:05 PM
#3
Thread Starter
Junior Member
Re: System.OutOfMemoryException
Thanks for the reply...i'm getting this exception when saving...Ya i'm using a lot of images in the forms...
-
Jan 24th, 2011, 03:12 PM
#4
Lively Member
Re: System.OutOfMemoryException
-
Jan 24th, 2011, 03:21 PM
#5
Thread Starter
Junior Member
Re: System.OutOfMemoryException
-
Jan 24th, 2011, 03:25 PM
#6
Lively Member
Re: System.OutOfMemoryException
Upgrade to 2GB, 1GB is not good enough today.
-
Jan 24th, 2011, 03:28 PM
#7
Thread Starter
Junior Member
Re: System.OutOfMemoryException
will my problem be solved if i do this?
-
Jan 24th, 2011, 03:30 PM
#8
Lively Member
Re: System.OutOfMemoryException
Yep, your problem is that you run out of RAM when saving.
Throw up Task Manager, performance tab and where it says physical memory, tell us the amount in Available.
-
Jan 24th, 2011, 03:41 PM
#9
Thread Starter
Junior Member
Re: System.OutOfMemoryException
This amount keeps changing but i've captured this one: 146372 Kb
-
Jan 24th, 2011, 03:57 PM
#10
Lively Member
Re: System.OutOfMemoryException
Definitely upgrade your RAM.
-
Jan 24th, 2011, 04:00 PM
#11
Thread Starter
Junior Member
Re: System.OutOfMemoryException
ok i'l do so...Thanks for the help
-
Jan 24th, 2011, 04:06 PM
#12
Re: System.OutOfMemoryException
The issue does appear to have to do with RAM, as that is the only memory that exception would really be noticing. 1GB is kind of low, and this is the easiest thing to try, and all other options are decidedly less pleasing. Therefore, if you can do the upgrade, then that is definitely the best option. Of course, it is also one of the few solutions in the programming section of this forum that costs actual money. Fortunately, the result will be more RAM, even if it doesn't solve the problem.
My usual boring signature: Nothing
 
-
Jan 24th, 2011, 04:11 PM
#13
Lively Member
Re: System.OutOfMemoryException
If you run Vista, your PC is a snail. If it's XP, it's a snail too.
-
Jan 24th, 2011, 11:00 PM
#14
Banned
Re: System.OutOfMemoryException
right click command line (the line with windows start), task manager, processes, end processes you don't need it should free up some ram, then if you don't get the problem again you know you should ad ram memory or just uninstall needless programs.
-
Jan 24th, 2011, 11:16 PM
#15
Re: System.OutOfMemoryException
No, the issue does not appear to be about RAM. If you want to understand OutOfMemory exceptions, read this article.
In particular, this line:
By now it should be clear why “out of memory” errors usually have nothing to do with how much physical memory you have, or how even how much storage is available. It’s almost always about the address space, which on 32 bit Windows is relatively small and easily fragmented.
I would suggest that Visual Studio is being ridiculous and loading all those images into memory. A better upgrade than more RAM (which won't increase the address space) would be perhaps an upgrade to 64-bit. However, that's a bit extreme. Is there anyway you can handle the images differently? Maybe change them from Embedded Resources to loosely associated files on disk? (Disclaimer: no idea if that will make any difference)
Also, consider if you actually need that many images?
-
Jan 24th, 2011, 11:36 PM
#16
Re: System.OutOfMemoryException
Actually, thinking about it, Visual Studio is still a 32-bit process, so upgrading to 64-bit won't necessarily get you anything (although I think you should be able to get up to 4GB addressable space rather than 2GB/3GB, as the OS doesn't eat up any of the address space.)
-
Jan 26th, 2011, 01:51 PM
#17
Thread Starter
Junior Member
Re: System.OutOfMemoryException
As suggested, i upgraded my RAM to 2GB but i'm still getting the same problem...When i click on save, it tells me that there's insufficient memory to execute this operation. I don't know what to do now. My project is stuck. Please help.
-
Jan 26th, 2011, 03:09 PM
#18
Re: System.OutOfMemoryException
I think EvilG has the next things to try at the end of his post #16. I would certainly try holding just the file names and loading the files as needed. It may not be the ultimate solution, as loading the files in this fashion might not be sufficient, but as a test, it would be relatively easy to implement. If it solves your problem (and it should if you go to the length of hardcoding the filenames into the program such that they are part of the code itself rather than any resource), then you have positively determined that the images are the cause (there is at least one alternative, which is a corrupted VS installation). From there...well, there are options with various levels of ugliness.
My usual boring signature: Nothing
 
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
|