Click here to Skip to main content
15,922,523 members
Home / Discussions / C#
   

C#

 
GeneralRe: Has anybody ever seen this IO exception before? Pin
led mike2-Mar-09 11:56
led mike2-Mar-09 11:56 
GeneralRe: Has anybody ever seen this IO exception before? Pin
snorkie2-Mar-09 12:03
professionalsnorkie2-Mar-09 12:03 
AnswerRe: Has anybody ever seen this IO exception before? Pin
Yusuf2-Mar-09 12:15
Yusuf2-Mar-09 12:15 
AnswerRe: Has anybody ever seen this IO exception before? Pin
pbarrette3-Mar-09 15:30
pbarrette3-Mar-09 15:30 
QuestionHow to create an instance of a c++ class inside a dll in a c# project Pin
EcK3kO2-Mar-09 11:16
EcK3kO2-Mar-09 11:16 
AnswerRe: How to create an instance of a c++ class inside a dll in a c# project Pin
led mike2-Mar-09 11:32
led mike2-Mar-09 11:32 
QuestionEasy memory optimizations? Pin
bbranded2-Mar-09 10:54
bbranded2-Mar-09 10:54 
AnswerRe: Easy memory optimizations? Pin
Dave Kreskowiak2-Mar-09 11:04
mveDave Kreskowiak2-Mar-09 11:04 
First, if you're looking in TaskManager to see the memory usage, it's lying to you. You're app isn't taking that much memory. A .NET app, like Java, runs in a kind of virtual machine. What you're seeing is what the .NET CLR has reserved for your application, even if the memory isn't being used. No, you can't do anything about it since all memory management is done automatically by the CLR.

If Windows needs the memory the CLR has reserved back, the CLR is more than happy to return whatever it can. The reseason the memory is reserved to start with is because when your code allocates memory for an object, it's much quickler to allocate it out of the managed heap the CLR maintains, than it is to go back to Windows, ask for a block of memory, add it to the managed heap, then allocate your object.

Calling the GarbageCollector doesn't do anything for you except screw up the internal optimization algorithm it uses. Unless you're an advanced developer with a definite need to do this and know precisely why you're doing it and the consequences of doing it, you show never force the GC to do an early collection.

Plus, 12 to 15MB of memory is nothing now-a-days, so what are you worried about??


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: Easy memory optimizations? Pin
Yusuf2-Mar-09 12:20
Yusuf2-Mar-09 12:20 
GeneralRe: Easy memory optimizations? Pin
Dave Kreskowiak2-Mar-09 16:43
mveDave Kreskowiak2-Mar-09 16:43 
AnswerRe: Easy memory optimizations? Pin
Luc Pattyn2-Mar-09 11:26
sitebuilderLuc Pattyn2-Mar-09 11:26 
GeneralRe: Easy memory optimizations? Pin
bbranded2-Mar-09 12:26
bbranded2-Mar-09 12:26 
GeneralRe: Easy memory optimizations? Pin
Luc Pattyn2-Mar-09 12:29
sitebuilderLuc Pattyn2-Mar-09 12:29 
AnswerRe: Easy memory optimizations? Pin
DaveyM692-Mar-09 12:50
professionalDaveyM692-Mar-09 12:50 
GeneralRe: Easy memory optimizations? [modified] Pin
bbranded2-Mar-09 13:01
bbranded2-Mar-09 13:01 
QuestionRegex Pin
Dromar2-Mar-09 10:54
Dromar2-Mar-09 10:54 
AnswerRe: Regex Pin
Maxim Langman2-Mar-09 11:11
Maxim Langman2-Mar-09 11:11 
AnswerRe: Regex Pin
snorkie2-Mar-09 11:23
professionalsnorkie2-Mar-09 11:23 
GeneralRe: Regex Pin
Dromar2-Mar-09 12:12
Dromar2-Mar-09 12:12 
GeneralRe: Regex Pin
snorkie2-Mar-09 13:23
professionalsnorkie2-Mar-09 13:23 
GeneralRe: Regex Pin
Dromar3-Mar-09 5:37
Dromar3-Mar-09 5:37 
QuestionGetting TableName in Tables of DataSet Pin
Maxim Langman2-Mar-09 10:25
Maxim Langman2-Mar-09 10:25 
AnswerRe: Getting TableName in Tables of DataSet Pin
PIEBALDconsult2-Mar-09 12:52
mvePIEBALDconsult2-Mar-09 12:52 
QuestionRe: Getting TableName in Tables of DataSet [modified] Pin
Maxim Langman2-Mar-09 19:35
Maxim Langman2-Mar-09 19:35 
AnswerRe: Getting TableName in Tables of DataSet Pin
PIEBALDconsult3-Mar-09 3:28
mvePIEBALDconsult3-Mar-09 3:28 

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.