Good Tutorial for memory management.

I've gone through a good amount of the core c++ library now. The book doesn't go into key words like new and delete. From what I can tell, this a more difficult area of C++ where you really need to make sure you know what you're doing, or else you can really screw yourself. Can any of you reference me what you consider a good tutorial, perhaps give some tips? I don't want to go wrong here.
closed account (3CXz8vqX)
You mean apart from the cplusplus tutorials on Dynamic Memory Allocation? I highly recommend it.
@Austin J

Read up about smart pointers i.e std::shared_ptr , std::unique_ptr , std::auto_ptr

These are C++11 reference counting pointers, and delete themselves once all the references to them are gone - so no need to worry about using delete yourself, or wondering whether delete will actually be called.

A really good book to get is Scott Meyers book "Effective C++", I have the 3rd edition, but there is the C++11 version due out soon. He does talk about some C++11 stuff in the 3rd Ed, the newer book has even more apparently. The book is not really aimed at beginners - one needs a good grasp of all the different features of C++ to be able to understand what he is saying. I don't know what stage you are at with your level of understanding, I thought it was worth a mention anyway.

Hope all goes well. :)
Last edited on
I know a good deal of the
c++ syntax (obviously not all of it, i.e as I understand there's like a gazillion string functions). I'll look into it, thanks!
I meant the concepts of C++, (as opposed to the STL), such as exception handling, all the constructor types, operator overloading, inheritance, polymorphism, function overloading, templates, namespaces etc . A reader of his book needs to understand what all these are - he doesn't explain them, rather discusses what can go wrong & ways to do things better.

The first Item in Scott's book talks about viewing C++ as a federation of 4 sub-languages (C, OOP C++ , Template C++, & C++ STL). It's the second one in this list that one needs to understand more than the fourth.

Last edited on
I've gotten into all of those except namespaces and constructor types.
Good. I just didn't want to mention the book, then after buying it, you discover you don't know what any of it means :)

You can read up about copy constructors and copy assignment in wiki.

Namespaces are not hard - Scott Meyers recommends keeping all your classes in your own namespace, rather than the global one.
new and delete come to the party in OOP with dynamic objects

I am using a book called Object Oriented Programming with C++(2nd edition)
by David Parsons. Really good book. site looks better too
Last edited on
Thanks guys!
Topic archived. No new replies allowed.