
Garbage Collector
turui
这个作者很懒,什么都没留下…
展开
-
Let's go,Garbage Collector(八)
The garbage collection list in gclist holds objects of type GCInfo. The GCInfo class is shown here:// This class defines an element that is stored// in the garbage collection information list.//temp转载 2008-01-17 13:58:00 · 746 阅读 · 0 评论 -
Let's go,Garbage Collector(七)
GCPtr overloads operator=( ) twice: once for the assignment of a new address to a GCPtr pointer, and once for the assignment of one GCPtr pointer to another. Both versions are shown here:// Overload转载 2008-01-17 13:42:00 · 1146 阅读 · 0 评论 -
Let's go,Garbage Collector(十)
If you are allocating an array using new, then you must tell GCPtr this fact by specifying its size when the GCPtr pointer to that array is declared. For example, here is the way to allocate an array转载 2008-01-17 14:02:00 · 1031 阅读 · 0 评论 -
Let's go,Garbage Collector(十二)
The following program load tests GCPtr by repeatedly allocating and discarding objects until free memory is exhausted. When this occurs, a bad_alloc exception is thrown by new. Inside the exception ha转载 2008-01-17 14:05:00 · 764 阅读 · 0 评论 -
关于“最袖珍的垃圾回收器”的实现(头文件)
/**//******************************************************************************* Notice: Copyright (c) 2007 Some - All Rights Reserved **** create: turui**** Date: 2007.12.19**** File Name: T原创 2008-01-17 14:22:00 · 765 阅读 · 0 评论 -
关于“最袖珍的垃圾回收器”的实现(C文件)
/**//******************************************************************************* Notice: Copyright (c) 2007 Some - All Rights Reserved **** create: turui**** Date: 2007.12.19**** File Name: T原创 2008-01-17 14:24:00 · 917 阅读 · 0 评论 -
关于“最袖珍的垃圾回收器”的实现(分析)
麻痹的不会在优快云上贴图片,只好用文字来表达了实际上,这个最简单的垃圾回收器的实现,我们只用关心,两个指针,以及一个结构,在我的代码中如下 // 定义只在本文件中使用的静态变量,并初始化static BYTE* m_begin = (BYTE*)HeaderSize;static BYTE* m_end = (BYTE*)HeaderSize; //原创 2008-01-17 15:13:00 · 954 阅读 · 0 评论 -
嵌入式(标准C环境下)下通用的内存池的实现---前言
/*对内存池的需求分析: 我们希望我们开发的某个应用可以使用以一块固定的内存空间 这块内存空间是一开始申请好的, 所有的内存使用都是在这块空间内完成,可以避免和其他应用的内存使用相互冲突 可以对应用使用的内存情况进行部分统计 可以在应用退出后自动对内存进行回收(我们假设用户的习编程惯是不良好的,有可能产生内存泄露)尤原创 2008-10-24 09:33:00 · 1698 阅读 · 0 评论 -
嵌入式(标准C环境下)下通用的内存池的实现---头文件
#ifndef __AVIT_OC_GEN_H__ #define __AVIT_OC_GEN_H__ #ifdef _MSC_VER #include "wtypes.h" #include "stdio.h" #endif #include "j_gendef.h" #include "avit_oc_config.h"原创 2008-10-24 09:45:00 · 1036 阅读 · 0 评论 -
嵌入式(标准C环境下)下通用的内存池的实现---C文件
#include "avit_memory_pool.h" #include "avit_oc_print.h" static UINT32 peak_memory_use = 0;static UINT32 now_memory_use = 0;static BYTE* pool_adr = NULL;static MemNode* pool_link = N原创 2008-10-24 09:48:00 · 1230 阅读 · 0 评论 -
Let's go,Garbage Collector(五)
The garbage collector uses four classes: GCPtr, GCInfo, Iter, and OutOfRangeExc. Before examining the code in detail, it will be helpful to understand the role each class plays.GCPtr GCPtr is a转载 2008-01-17 13:37:00 · 718 阅读 · 0 评论 -
Let's go,Garbage Collector(三)
Before implementing a garbage collector for C++, it is necessary to decide what garbage collection algorithm to use. The topic of garbage collection is a large one, having been the focus of serious ac转载 2008-01-17 13:33:00 · 1794 阅读 · 0 评论 -
Let's go,Garbage Collector(九)
Using a GCPtr is quite easy. First, include the file gc.h. Then, declare a GCPtr object, specifying the type of the data to which it will point. For example, to declare a GCPtr object called p that ca转载 2008-01-17 14:00:00 · 735 阅读 · 0 评论 -
关于“最袖珍的垃圾回收器”的实现(序)
前一段时间工作需要,在收集资料的过程中看了 许世 伟的“最袖珍的垃圾回收器”一文原文http://blog.youkuaiyun.com/xushiweizh/archive/2006/11/19/1396573.aspx但有几方面觉得不太合适,自己罗嗦几句吧第一 BLOG里的代码有明显的错误,没有更正第二 写的还是不够好理解吧,可能是自己水平太差,反正我反复看了不下十遍才基本看懂第三原创 2008-01-17 14:20:00 · 699 阅读 · 0 评论 -
HP garbage collector portting
原文http://www.hpl.hp.com/personal/Hans_Boehm/gc/porting.htmlConservative GC Porting Directions保守(*还是守恒)的 GC 移植 说明The collector is designed to be relatively easy to port, but is not portable co翻译 2008-01-17 13:01:00 · 1641 阅读 · 0 评论 -
Let's go,Garbage Collector(二)
Comparing the Two Approaches to Memory Management Before developing a garbage collector for C++, it is useful to compare garbage collection to the manual method that is built-in to C++. Normally, th转载 2008-01-17 13:27:00 · 1072 阅读 · 0 评论 -
Let's go,Garbage Collector(一)
The use of dynamically allocated memory must be managed, because it has a tremendous effect on the performance of your programs. The current trend in handling dynamic memory seems to be shifting towar转载 2008-01-17 13:24:00 · 1468 阅读 · 0 评论 -
Let's go,Garbage Collector(四)
What About auto_ptrAs many readers will know, C++ defines a library class called auto_ptr. Because an auto_ptr automatically frees the memory to which it points when it goes out of scope, you might转载 2008-01-17 13:35:00 · 846 阅读 · 0 评论 -
Let's go,Garbage Collector(六)
GCPtr is the heart of the garbage collector. It implements a new pointer type that keeps a reference count for objects allocated on the heap. It also provides the garbage collection functionality t转载 2008-01-17 13:39:00 · 685 阅读 · 0 评论 -
Let's go,Garbage Collector(十一)
The following program shows a larger example that exercises all of the features of GCPtr:// Demonstrating GCPtr.#include #include #include "gc.h"using namespace std;// A simple class for testing GCP转载 2008-01-17 14:03:00 · 565 阅读 · 0 评论 -
关于“最袖珍的垃圾回收器”的实现(使用)
建立静态库工程,将 前面发布的 头文件及C文件, 打包成静态库 TRSimpleGC.lib实际上前面的代码是和平台无关的,如果要在其他平台下编译,只要单独编译C文件,并用相应的AR打包器打包成静态库即可。为方便我们以WIN平台为例子,使用方法也很简单,代码如下后面我将再章节,我讲再讲讲,这个简单,而又神奇的GC的实现以及它的问题,以帮助理解及深入的研究原创 2008-01-17 14:33:00 · 830 阅读 · 0 评论 -
嵌入式(标准C环境下)下通用的内存池的实现---后记(使用)
// 将常用的 malloc 和 free 替换成池提供的内存访问函数 void* memory_pool_malloc(UINT32 size);void memory_pool_free(void* pAddr);// 记得初在应用最开始始化和最后释放 memory_pool_init() memory_pool_release();// 在嵌入式环境下原创 2008-10-24 09:50:00 · 1216 阅读 · 0 评论