C++ Memory management References [closed]
I am really confused about memory management in C++. What is the best reference (book or web) that deals with memory allocation, stack, heap, free store and scope & lifetime of variables.
Is there any resource that contrasts C++ memory allocation basics with that in C#?
The C++ FAQ deals with memory management issues extensively.
I strongly recommend Expert C Programming: Deep C Secrets for learning all about these little details. It's got nothing to do with C++, but you'll learn almost everything you asked about :) and the writing is superb, which is pretty rare with C++ books.
RAII in conjunction with smart pointers (std::unique_ptr, std::shared_ptr) is basically all you will need. If you stick with it you will get exception safe, memory leak free code :)
精彩评论