您的位置:首页 > 编程语言 > C语言/C++

一些关于C++ 内存管理的比较好的文章,代码

2015-10-14 11:26 405 查看
在看一下内存管理的资料,把一些比较好的留下。


0. C++资源集锦

https://github.com/fffaraz/awesome-cpp


Awesome C/C++


1. C++11 Smart Pointers

http://www.codeproject.com/Articles/541067/Cplusplus-Smart-Pointers


Introduction

Ooops. Yet another article on smart pointers of C++11. Nowadays I hear a lot of people talking about the new C++ standard which is nothing but C++0x/C++11. I went through some of the language features of C++11 and it's really an amazing work. I'll focus only
on the smart pointers section of C++11.


2. Heap Memory Manager and
Garbage Collector

http://www.codeproject.com/Articles/25284/Heap-Memory-Manager-and-Garbage-Collector


Introduction

This article demonstrates a method to try and solve a common problem hated by most C++ programmers:memory leaks
and memory overruns. The method used in this article is
to track all memory allocated by the program. It also has
basic protection checks whether the memory written to the
allocated block has overrun the number of bytes actually allocated.

This method also lets you organize and group allocated memory by
ID or by name. Giving a name to a memoryallocation gives
the advantage that you can get the memory allocated by name
while not needing to keep a pointer running around. Giving a group ID to an allocation helps the programmer to keep memory allocations
grouped and thus can call a single function to deallocate all memory of
a certain group.


3. C++ Memory Management Innovation: GC Allocator

http://www.codeproject.com/Articles/25451/C-Memory-Management-Innovation-GC-Allocator


Introduction

Most of the C++ programmers do not benefit from "Garbage
Collection" technique (GC). They are sick of deleting objects but have to do this. There are some C/C++ memory GC
implementations, but they are complex and are not widely used.

I am going to introduce a new memory management technique
named "GC Allocator". "GC Allocator" isn't an implementation, but a concept. Now, we have two "GC Allocator" implementations, named "AutoFreeAlloc" and "ScopeAlloc".

This article consists of three parts:

What is GC Allocator?

GC Allocator implementations: ScopeAlloc and AutoFreeAlloc

Applications based on GC Allocator


4. Memory Leak Detection

http://www.codeproject.com/Articles/8448/Memory-Leak-Detection


Introduction

OK, So you want a memory leak detector
and don't want to pay thru the nose for it! You've gone ahead and read all the articles on Memory Leak Detection
(whew!!) and are totally confused and frustrated with all the technical details on how to hook memory,
walk a stack, display symbols and still get the performance you need to run your application. You've Looked at lots of code and found that it's kind of a big mess to add your ownmemory leak detection.
Well I hope that I can help out and clear the air. I have managed to create a single class that you can add to your code and find those pesky memory leaks.
You can do this in debug mode or final release mode and customize your own memory leak detection.


4. CxImage

http://www.codeproject.com/Articles/1300/CxImage

CxImage is a C++ class to load, save, display, transform BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX, TGA, WMF, WBMP, JBG, J2K images.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  C++