Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to print a web page in c# without using Javascript Pin
smiley_jatin2-Aug-09 22:44
smiley_jatin2-Aug-09 22:44 
GeneralRe: how to print a web page in c# without using Javascript Pin
dan!sh 2-Aug-09 23:12
professional dan!sh 2-Aug-09 23:12 
GeneralRe: how to print a web page in c# without using Javascript Pin
marcoreg4-Aug-09 4:54
marcoreg4-Aug-09 4:54 
Question64bit and OutOfMemory Pin
Super Lloyd2-Aug-09 20:32
Super Lloyd2-Aug-09 20:32 
AnswerRe: 64bit and OutOfMemory Pin
Christian Graus2-Aug-09 20:40
protectorChristian Graus2-Aug-09 20:40 
GeneralRe: 64bit and OutOfMemory Pin
Super Lloyd2-Aug-09 23:38
Super Lloyd2-Aug-09 23:38 
AnswerRe: 64bit and OutOfMemory Pin
Vimalsoft(Pty) Ltd2-Aug-09 21:39
professionalVimalsoft(Pty) Ltd2-Aug-09 21:39 
AnswerRe: 64bit and OutOfMemory Pin
Luc Pattyn3-Aug-09 0:10
sitebuilderLuc Pattyn3-Aug-09 0:10 
Hi,


This is a standard text of mine, as the question pops up regularly:

----------------------------------------------------
I know of three ways to get an OOM Exception:

1.
the most surprising one: some method throw OOM on bad inputs, most notoriously: Image.FromFile().

2.
you are really running out of memory; typically that means you are preventing objects from being collected. You can watch your app grow, roughly through Task Manager; more correctly by incorporating a display of Environment.WorkingSet in your app.

One way of keeping objects around is by storing references to lots of, or all, objects you create; maybe for debugging, for statistical information, as a cache, whatever. If so, consider the WeakReference class.

3.
you have objects larger than 80KB; those get allocated on the "large-object-heap", which never gets compacted, and hence could become fragmented, resulting in an OOM even when lots of free memory is still around (but each chunk is smaller than the size needed).

Remember: lots of collections (ArrayList, List< T>, etc) are stored as arrays, and such arrays get doubled in size and copied each time their capacity gets exceeded.
IMO you can't reliably design a long running .NET app if you need large objects, unless you:
- either make them all the same size;
- or perform the entire memory management for large objects yourself.
Both of which may be tedious. A third possibility is making your app restart periodically all by itself.

----------------------------------------------------

As you say your app is both small and slow, there must be something really wrong. Why don't you show all relevant code (in PRE tags!)? My best guess is you are building very long strings (or collections) and your app's memory is getting fragmented. That is possible, no matter what Windows version, Framework version and amount of memory/virtual memory you have.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.

GeneralRe: 64bit and OutOfMemory Pin
Super Lloyd3-Aug-09 0:28
Super Lloyd3-Aug-09 0:28 
GeneralRe: 64bit and OutOfMemory Pin
Luc Pattyn3-Aug-09 0:55
sitebuilderLuc Pattyn3-Aug-09 0:55 
GeneralRe: 64bit and OutOfMemory Pin
Super Lloyd3-Aug-09 1:09
Super Lloyd3-Aug-09 1:09 
AnswerRe: 64bit and OutOfMemory Pin
Alan Balkany3-Aug-09 4:47
Alan Balkany3-Aug-09 4:47 
QuestionHow to detect if a folder is open Pin
rick05562-Aug-09 20:25
rick05562-Aug-09 20:25 
AnswerRe: How to detect if a folder is open Pin
Christian Graus2-Aug-09 20:37
protectorChristian Graus2-Aug-09 20:37 
Answer[Message Deleted] Pin
Hristo-Bojilov2-Aug-09 21:31
Hristo-Bojilov2-Aug-09 21:31 
GeneralRe: How to detect if a folder is open Pin
rick05562-Aug-09 21:45
rick05562-Aug-09 21:45 
GeneralRe: How to detect if a folder is open Pin
Christian Graus2-Aug-09 21:58
protectorChristian Graus2-Aug-09 21:58 
GeneralRe: How to detect if a folder is open Pin
Dave Kreskowiak3-Aug-09 3:49
mveDave Kreskowiak3-Aug-09 3:49 
GeneralRe: How to detect if a folder is open Pin
Hristo-Bojilov3-Aug-09 7:37
Hristo-Bojilov3-Aug-09 7:37 
QuestionLinq Pin
Sayed Sajid2-Aug-09 20:21
Sayed Sajid2-Aug-09 20:21 
AnswerRe: Linq Pin
Christian Graus2-Aug-09 20:35
protectorChristian Graus2-Aug-09 20:35 
GeneralRe: Linq Pin
Sayed Sajid2-Aug-09 20:42
Sayed Sajid2-Aug-09 20:42 
GeneralRe: Linq Pin
riced2-Aug-09 23:18
riced2-Aug-09 23:18 
AnswerRe: Linq Pin
N a v a n e e t h2-Aug-09 20:42
N a v a n e e t h2-Aug-09 20:42 
QuestionFinding Nested ( ) pairs Pin
Adam R Harris2-Aug-09 20:07
Adam R Harris2-Aug-09 20:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.