开发者

C++ Memory management References [closed]

开发者 https://www.devze.com 2023-02-04 23:57 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_Python百科 Closed 12 years ago.

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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消