Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat do I need to know about memory in C++?
    primarykey
    data
    text
    <p>I've been doing my best to learn C++ but my previous training will fall short in one major issue: memory management. My primary languages all have automatic garbage collection, so keeping track of everything has never really been necessary. I've tried reading up on memory management in C++ online, but I have this shaking suspicion that I am strill missing something.</p> <p>So, here's a multi-part question:</p> <ul><li>What is the bare minimum I need to know about memory management? (or, where do I go to find that out)?</li><li>Where do I go for intermediate and advanced knowledge/tutorials/etc (once I am done with the basics)?</li><br/>More specifically:<li>What is the performance difference between pointers and references?</li><li>I've heard that in loops, you need to make sure that you call <code>delete</code> on any new pointers before the loop re-iterates. Is this correct? Do you need to do something with references?</li><li>What are some classic examples of memory leaks?</li><li>What do I need to know about the following (and will I ever realistically need to use them -- if so, where?): <ul><li><code>malloc</code></li><li><code>free</code></li><li><code>calloc</code></li><li><code>realloc</code></li></ul></li></ul> <p>*********************** UPDATE *******************</p> <p>This is to address a reference to lmgtfy in comment one (by Ewan). If you start reading the information which is available there, it is not useful to the beginner. It is great theory, I think, but it is neither pertinent or useful to this question.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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