Click here to Skip to main content
15,566,096 members
Home / Discussions / C#
   

C#

 
AnswerRe: What Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
OriginalGriff27-Jul-22 1:04
mvaOriginalGriff27-Jul-22 1:04 
AnswerRe: What Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
Calin Negru28-Jul-22 1:11
Calin Negru28-Jul-22 1:11 
QuestionHow to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 7:35
Code4Ever26-Jul-22 7:35 
GeneralRe: How to convert pdf file into FileStream? Pin
Richard MacCutchan26-Jul-22 7:49
mveRichard MacCutchan26-Jul-22 7:49 
GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 7:59
Code4Ever26-Jul-22 7:59 
GeneralRe: How to convert pdf file into FileStream? Pin
Richard Deeming26-Jul-22 23:03
mveRichard Deeming26-Jul-22 23:03 
GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever28-Jul-22 20:52
Code4Ever28-Jul-22 20:52 
AnswerRe: How to convert pdf file into FileStream? Pin
Dave Kreskowiak26-Jul-22 8:24
mveDave Kreskowiak26-Jul-22 8:24 
First, are you looking in Task Manager to determine this?

It's lying to you. It's not showing you how much memory your app is taking. It's showing you how much is RESERVED for your app.

You have to understand how memory allocations work in the .NET CLR and how it relates to Windows memory management. The .NET CLR manages the "Managed Heap", which is what your app sees (and Task Manager does NOT). When your app allocates an object, it's allocated on the Managed Heap. When an object is freed, that memory goes back into the Managed Heap, NOT BACK TO WINDOWS!

Just because your code is not using an object anymore, that does NOT mean the memory it occupies is immediately returned to the Managed Heap!

When more objects need to be allocated, it's faster for the CLR to allocate from the Managed Heap than it is for it to find out there's not enough enough heap left, go to Windows to get another block of memory, add it to the heap, then allocate your object.

This is why you're seeing what's RESERVED for your app.

When the CLR feels the conditions are right, it cleans up the managed heap, moving objects around and freeing up objects that don't have a reference being held anymore, returning that freed memory back to the Managed Heap. This is called Garbage Collection.

When Windows needs more memory, it asks the .NET CLR for whatever it can free up. If there's sufficient space on the Managed Heap, it'll shrink the size of the heap and return that freed memory back to Windows. If your code quickly allocats lots of objects and frees them, this can give the illusion of a memory leak.

GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 8:39
Code4Ever26-Jul-22 8:39 
GeneralRe: How to convert pdf file into FileStream? Pin
Dave Kreskowiak26-Jul-22 8:45
mveDave Kreskowiak26-Jul-22 8:45 
QuestionTechnic or best way to know if an application is "ready" when it is started from another application ? Pin
Maximilien25-Jul-22 2:14
Maximilien25-Jul-22 2:14 
AnswerRe: Technic or best way to know if an application is "ready" when it is started from another application ? Pin
Richard MacCutchan25-Jul-22 4:08
mveRichard MacCutchan25-Jul-22 4:08 
AnswerRe: Technic or best way to know if an application is "ready" when it is started from another application ? Pin
Gerry Schmitz27-Jul-22 7:43
mveGerry Schmitz27-Jul-22 7:43 
QuestionAsync web request Pin
moxol23-Jul-22 12:06
moxol23-Jul-22 12:06 
AnswerRe: Async web request Pin
Gerry Schmitz23-Jul-22 15:48
mveGerry Schmitz23-Jul-22 15:48 
QuestionPlease give me some explaination about the following Microsoft.ToolKit.MVVM Pin
Code4Ever23-Jul-22 8:17
Code4Ever23-Jul-22 8:17 
AnswerRe: Please give me some explaination about the following Microsoft.ToolKit.MVVM Pin
OriginalGriff23-Jul-22 10:18
mvaOriginalGriff23-Jul-22 10:18 
QuestionClient and Server side validations for Calendar control Pin
Member 995054522-Jul-22 5:20
Member 995054522-Jul-22 5:20 
AnswerRe: Client and Server side validations for Calendar control Pin
Gerry Schmitz22-Jul-22 6:18
mveGerry Schmitz22-Jul-22 6:18 
QuestionI still didnt figure out how to upate a DGV without pressing enter Pin
grennday21-Jul-22 20:22
grennday21-Jul-22 20:22 
AnswerRe: I still didnt figure out how to upate a DGV without pressing enter Pin
Richard MacCutchan22-Jul-22 2:05
mveRichard MacCutchan22-Jul-22 2:05 
GeneralRe: I still didnt figure out how to upate a DGV without pressing enter Pin
grennday26-Jul-22 3:15
grennday26-Jul-22 3:15 
GeneralRe: I still didnt figure out how to upate a DGV without pressing enter Pin
Richard MacCutchan26-Jul-22 3:25
mveRichard MacCutchan26-Jul-22 3:25 
QuestionPutting event handler codes inside DoWork delegate for asynchronous multi-threaded calculations Pin
Code4Ever15-Jul-22 19:35
Code4Ever15-Jul-22 19:35 
AnswerRe: Putting event handler codes inside DoWork delegate for asynchronous multi-threaded calculations Pin
OriginalGriff15-Jul-22 20:45
mvaOriginalGriff15-Jul-22 20: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.