Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Static constructor Pin
mabrahao6-Jan-10 1:15
mabrahao6-Jan-10 1:15 
AnswerRe: Static constructor Pin
OriginalGriff6-Jan-10 1:07
mveOriginalGriff6-Jan-10 1:07 
GeneralRe: Static constructor Pin
mabrahao6-Jan-10 1:11
mabrahao6-Jan-10 1:11 
QuestionProblem in memory usage in .net Pin
Kim06186-Jan-10 0:11
Kim06186-Jan-10 0:11 
AnswerRe: Problem in memory usage in .net PinPopular
Harvey Saayman6-Jan-10 0:40
Harvey Saayman6-Jan-10 0:40 
GeneralRe: Problem in memory usage in .net Pin
Rob Philpott6-Jan-10 3:12
Rob Philpott6-Jan-10 3:12 
AnswerRe: Problem in memory usage in .net Pin
Dave Kreskowiak6-Jan-10 3:22
mveDave Kreskowiak6-Jan-10 3:22 
AnswerRe: Problem in memory usage in .net Pin
Luc Pattyn6-Jan-10 3:30
sitebuilderLuc Pattyn6-Jan-10 3:30 
There are many ways to run out of memory. The most obvious one is keeping things around that you no longer need but for some reason still hold on to.

.NET sometimes has a problem with the "large object heap" (LOH) which never gets compacted, and may run out of space. A popular culprit is a collection growing larger and larger. As soon as it hold 20,000+ objects, the reference array is a large object (as it exceeds 80KB); any time it needs more capacity, it gets reallocated with twice its size. The space occupied by the old array is freed, but will not be reused by that same array as it keeps growing.

Of course the objects themselves in the collection also take memory; that may or may not come from the LOH, depending on their size.

If, I don't know you do, but if you are building a cache of some sort, you should keep its size in check, and probably use WeakReference techniques.

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.


GeneralRe: Problem in memory usage in .net Pin
Kim06186-Jan-10 6:02
Kim06186-Jan-10 6:02 
GeneralRe: Problem in memory usage in .net Pin
Luc Pattyn6-Jan-10 6:30
sitebuilderLuc Pattyn6-Jan-10 6:30 
QuestionProblem with insert query Pin
<<Tash18>>6-Jan-10 0:10
<<Tash18>>6-Jan-10 0:10 
AnswerRe: Problem with insert query Pin
SeMartens6-Jan-10 0:22
SeMartens6-Jan-10 0:22 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 0:23
<<Tash18>>6-Jan-10 0:23 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 0:27
SeMartens6-Jan-10 0:27 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 0:35
<<Tash18>>6-Jan-10 0:35 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 0:42
SeMartens6-Jan-10 0:42 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 0:58
<<Tash18>>6-Jan-10 0:58 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 1:06
SeMartens6-Jan-10 1:06 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 1:14
<<Tash18>>6-Jan-10 1:14 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 1:19
SeMartens6-Jan-10 1:19 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 1:28
<<Tash18>>6-Jan-10 1:28 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 1:31
SeMartens6-Jan-10 1:31 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 1:36
<<Tash18>>6-Jan-10 1:36 
GeneralRe: Problem with insert query Pin
SeMartens6-Jan-10 1:44
SeMartens6-Jan-10 1:44 
GeneralRe: Problem with insert query Pin
<<Tash18>>6-Jan-10 1:45
<<Tash18>>6-Jan-10 1:45 

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.