c++內存管理學習綱要
本係列文章,主要是學習c++內存管理這一塊的學習筆記。
時間:6.7-21
之下以技術內幕的開頭語,帶入到學習C++內存管理的技術中吧:
內存管理是C++最令人切齒痛恨的問題,也是C++最有爭議的問題,因此要想成為C++高手,內存管理一關是必須要過的!
筆記匯總:
7.C++內存管理學習筆記(7)(完)
番外篇:
1.C/C++數組和指針詳解;
2.c++中複製控製詳解(copy control);
個人認為,學習的態度是:不管是看書籍,看blog,看資料都要有懷疑和深究的態度!
以下部分是學習內存管理的資料,隨著學習的不斷深入,我相信資料也會越來越多!
相關書籍:
1.《C++內存管理技術內幕》(Download)
2.《深入理解 Linux 虛擬內存管理》翻譯版,Mel Gorman 著 譯者:白洛 李俊奎 劉森林(Download)
3.《池內春秋》作者:侯捷(Download)
4.《UNIX高級環境編程》(Download)
5.《c專家編程 expert c programing》(Download)
6.《C++ primer》(Download)
7.《STL源碼分析》(Download)
相關博客:
1.內存的堆分配和棧分配 & 字符數組,字符指針,Sizeof總結(author:小蝦米的窩):https://space.itpub.net/16856446/viewspace-612834;
2.C和C++中內存分配的細節:https://www.cnblogs.com/sj20082663/archive/2013/04/23/3037181.html;
3.C++ 工程實踐(2):不要重載全局 ::operator new():https://blog.csdn.net/solstice/article/details/6198937;
4.new、delete(new[]、delete[])操作符的重載:https://name5566.com/2339.html;
5.語義"陷阱"---數組和指針:https://www.cnblogs.com/yanlingyin/archive/2011/11/29/2268391.html#commentform;
6.數組和指針背後——內存角度:https://www.cnblogs.com/yanlingyin/archive/2011/12/06/2277821.html;
7.C++ 值傳遞、指針傳遞、引用傳遞詳解:https://www.cnblogs.com/yanlingyin/archive/2011/12/07/2278961.html;
8.C++中的類模板詳細講述:https://www.cnblogs.com/assemble8086/archive/2011/10/02/2198308.html;
9.C++類模板:https://blog.sina.com.cn/s/blog_5ea0192f0100cstj.html;
10.C++ Primer 4th 筆記,異常處理,auto_ptr類:https://www.cnblogs.com/mydomain/archive/2011/04/15/2017424.html;
11.泛型編程:源起、實現與意義:https://blog.csdn.net/pongba/article/details/2544894;;
12.C++深度探索係列:智能指針(Smart Pointer) [一]https://www.cppblog.com/bossbird/archive/2008/09/22/62434.html;
13.C++深度探索係列:智能指針(Smart Pointer) [二]:https://blog.csdn.net/redstar81/article/details/19755;
14.auto_ptr 代碼及缺陷:https://blog.csdn.net/wuzhekai1985/article/details/6603494;
15.高效使用auto_ptr:https://www.cppblog.com/mymsdn/archive/2010/04/07/Using-auto_ptr-Effectively.html;
16.effective c++ -- 資源管理:https://philoscience.iteye.com/blog/1402928;
17.C++著名程序庫的比較和學習經驗(STL.Boost.GUI.XML.網絡等等) -- ZZ from CU:https://hi.baidu.com/gikidy/item/96082ed10c9d2b14d90e449b;
18.Boost智能指針——shared_ptr:https://www.cnblogs.com/TianFang/archive/2008/09/19/1294521.html;
19.Boost 中的智能指針:https://www.cnblogs.com/sld666666/archive/2010/12/16/1908265.html;
20.C++拷貝構造函數詳解:https://blog.csdn.net/lwbeyond/article/details/6202256;
21.C++:複製構造函數在什麼時候被調用?:https://www.slyar.com/blog/cpp-copy-constructor.html;
22.C++內存管理變革:https://blog.csdn.net/xushiweizh/article/details/1388982;
相關資料:
1.內存管理內幕(IBM):https://www.ibm.com/developerworks/cn/linux/l-memory/;
介紹:本文將對 Linux™ 程序員可以使用的內存管理技術進行概述,雖然關注的重點是 C 語言,但同樣也適用於其他語言。文中將為您提供如何管理內存的細節,然後將進一步展示如何手工管理內存,如何使用引用計數或者內存池來半手工地管理內存, 以及如何使用垃圾收集自動管理內存。
2.C++內存管理的探討(1)(2)-(51cto):https://developer.51cto.com/art/201104/254712.htm;
介紹:大家都知道變量的生存周期這個概念,可是有的時候變量生存周期已經結束,但是所分配的那塊內存空間還是存在的。文章舉了四個不同的例子,來對C++內存管理進入深度探討,以說明這其中的原因。
3.C++內存管理不同方式分析(51cto):https://developer.51cto.com/art/201002/183110.htm;
介紹:C++內存管理的方式總共有三種,分別為自動存儲、靜態存儲、動態存儲。那麼如何正確的理解這三種方式呢?在這裏我們將會一一做一個介紹。
4.內存管理內幕(1)(2)(3)-(51cto):https://developer.51cto.com/art/200509/3600.htm;
介紹:本文將介紹手工的、半手工的以及自動的內存管理實踐的基本概念。
5.C++中內存分配詳解:https://developer.51cto.com/art/201107/276154.htm;
介紹:我們都知道,內存基本上分為靜態存儲區、堆區和棧區三大部分。本文介紹的是C++中的內存分配的問題,希望對你有幫助,一起來看。
6.建議33:小心翼翼地重載operator new/ operator delete:https://book.51cto.com/art/201202/317799.htm;
介紹:《編寫高質量代碼:改善C++程序的150個建議》本書是C++程序員進階修煉的必讀之作,包含的全部都是C++編碼的最佳實踐,從語法、編碼規範和編程習慣、程序架構和設計思想等三大方麵對C++程序和設計中的疑難問題給出了經驗性的解決方案,為C++程序員編寫更高質量的C++代碼提供了150條極為寶貴的建議。本節為大家介紹建議33:小心翼翼地重載operator new/ operator delete。
7.重載new和delete方法實現C++內存安全:https://www.2cto.com/kf/201210/162563.html
介紹:C++使用new關鍵字創建的對象,被分配到堆內存空間,然後得到對象地址,當程序複雜龐大時容易發生訪問地址bug或內存泄露bug。為了避免內存泄露並在調試程序時找到內存泄露的bug,可以重載new和delete函數,確保程序的內存安全
8.Arrays and Pointers:https://www.functionx.com/cpp/Lesson14.htm
9.C++ Pointer to an Array:https://www.tutorialspoint.com/cplusplus/cpp_pointer_to_an_array.htm;
10.Pointer types and Arrays:https://pw1.netcom.com/~tjensen/ptr/ch2x.htm;
11.C++ pointers vs arrays:https://www.tutorialspoint.com/cplusplus/cpp_pointers_vs_arrays.htm;
12. Array is not pointer:https://www.cplusplus.com/forum/articles/10/;
13.Pointers,Pointers and arrays:https://www.cplusplus.com/doc/tutorial/pointers/ ;
14.數組和指針背後——內存角度:https://www.cnblogs.com/yanlingyin/archive/2011/12/06/2277821.html;
15. 指針、數組和地址間的關係:https://book.51cto.com/art/201103/248065.htm;
介紹:《C語言開發手冊(典藏版)》第9章指針,本章首先介紹了C語言中指針的使用,主要包括指針的概念、指針變量的聲明和賦值,接著詳細講解了指針和數組的關係及指針的運算規則,然後介紹了指向多維數組的指針。同時,本章還對幾種特殊的指針進行了詳細的介紹,主要包括字符串指針、指針數組、指向指針的指針、指針和函數等。最後,本章還總結了指針的學習要點。本節為大家介紹指針、數組和地址間的關係。
16.C++類模板應用代碼深入剖析:https://developer.51cto.com/art/201002/183044.htm
17.C++中模板使用詳解(轉):https://www.360doc.com/content/09/0403/17/799_3011262.shtml;
18.More Effective C++之智能指針:https://dev.yesky.com/426/2496426.shtml;
19.詳解C++中的Boost智能指針:https://developer.51cto.com/art/201012/239004.htm;
介紹:今天我們要介紹boost中的智能指針的使用。對於內存管理,C++中有兩個實現方案: 垃圾回收機製和智能指針。而智能指針被認為是解決C++內存問題的最優方案。
20.What is a smart pointer and when should I use one?:https://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one
21.C++ 智能指針詳解:https://blog.csdn.net/xt_xiaotian/article/details/5714477
22.對C++資源管理內容分析研究:https://developer.51cto.com/art/201001/181314.htm
介紹:在C++資源管理中有這樣兩個概念,向上類型轉換,向下類型轉換,分別描述的是子類向基類和基類向子類的強製類型轉換。
23.Smart Pointers Overview:https://dlugosz.com/Repertoire/refman/Classics/Smart%20Pointers%20Overview.html;
24.Smart Pointers - What, Why, Which?:https://ootips.org/yonat/4dev/smart-pointers.html;
25.一步一步寫STL:定製智能指針(上):https://www.csdn123.com/html/blogs/20130601/18308.htm;
26.三十分鍾掌握STL:https://net.pku.edu.cn/~yhf/UsingSTL.htm;
27.boost庫之smart pointer:https://hi.baidu.com/drsuyxtmtlbiltd/item/5aed68f81b79ae13ce9f32bc;
28.Smart Pointers in Boost:https://www.drdobbs.com/cpp/smart-pointers-in-boost/184401507;
29.如何:創建和使用shared_ptr實例:https://msdn.microsoft.com/zh-cn/library/vstudio/hh279669.aspx;
30.class template std::shared_ptr:https://www.cplusplus.com/reference/memory/shared_ptr/;
31.boost::shared_ptr class template:https://www.boost.org/doc/libs/1_53_0/libs/smart_ptr/shared_ptr.htm;
32.Boost.shared_ptr必須注意的一些地方:https://www.360doc.com/content/10/1221/15/1801810_80092270.shtml;
33.Smart Pointers to boost your code:https://www.codeproject.com/Articles/8394/Smart-Pointers-to-boost-your-code;
34.Pimpl Idiom:https://c2.com/cgi/wiki?PimplIdiom;
35.C++ Copy Constructor:https://www.tutorialspoint.com/cplusplus/cpp_copy_constructor.htm;
36.C++ Notes: OOP: Copy Constructors:https://www.fredosaurus.com/notes-cpp/oop-condestructors/copyconstructors.html;
37.Assignment operators overloading in C++:https://www.tutorialspoint.com/cplusplus/assignment_operators_overloading.htm;
最後更新:2017-04-03 18:52:09