Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Memory from your program's perspective is divided in two blocks if you will. The Stack and the Heap.</p> <p>The Stack represents the current frame of execution (for instance the currently executing function), and it is used to pass function parameters, return values and is where local variables are generally stored. That memory is purged when the the current frame of execution ends (for example your function exiting).</p> <p>The Heap represents a memory pool where objects can be created and stored for longer periods of time. Generally, anything created using the "new" operator will go on the Heap, with the references existing on the Stack (for local context). If references to the allocated object stop being used, that memory remains taken until the Garbage Collector runs at some unspecified time in the future and frees the memory. When the GC runs can not be guaranteed - it might be when your program is running out of memory, or at scheduled intervals etc.</p> <p>I think in the memory behaviour you are observing, spikes are due to opening up and loading resources, troughs are after the GC runs. Another way to observe this is to look at a program's memory footprint when there is UI showing on the screen, and when the program is minimized. When minimized the memory footprint will shrink, because all the graphical elements are no longer necessary. When you maximize the UI and redraw it, memory usage peaks.</p> <p>You can look at the following articles for a better understanding of Stack and Heap:</p> <p><a href="https://stackoverflow.com/questions/79923/what-and-where-are-the-stack-and-heap">C# Stack and Heap</a></p> <p><a href="https://stackoverflow.com/questions/79923/what-and-where-are-the-stack-and-heap">What are stack and heap?</a></p> <p>You might also want to look into Garbage Collection:</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/bb985010.aspx" rel="nofollow noreferrer">Garbage collection article on MSDN</a></p> <p>... and <a href="http://www.albahari.com/valuevsreftypes.aspx" rel="nofollow noreferrer">Value vs Reference types</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload