资源简介
http://www.cs.cmu.edu/afs/cs/academic/class/15213-s00/L3/
CMU的垃圾回收实验(IN C)
1.这个实验由我主讲,我制作了PPT,包含三种思路,
2.并提供其中最重要也是最简单的扫描Stack Frame的源码。
3.此外,有整体思考的思维导图,供全局预览。
代码片段和文件信息
/* $Id$ */
/*
* Khalil Amiri
* amiri+@cs.cmu.edu
*
* CS213 - Fall 99 - Lab assignment 3
*
*/
#include
#include
#include
#include
#include
#include “ftime.h“
#include “memlib.h“
#include “malloc.h“
#include “dump.h“
#include “useful.h“
#include “getopt.h“
#include “tracefiles.h“
void usage(void);
/* magic numbers */
/* Win32: REF_TIME Adaptive Modification */
#define SPACE_UTIL_METRIC_WEIGHT 0.33
//#define REF_TIME 110.0
#define REF_TIME 0.035
#define MIN(ab) ( (a) < (b) ? (a):(b) )
/* test data structures */
typedef struct range_t {
struct range_t *next;
char *lo *hi;
} range_t;
typedef struct {
enum {ALLOC FREE} type;
long index;
long size;
} memop_t;
typedef struct {
int weight;
unsigned num_blocks;
long num_ops;
long suggested_heap_size;
memop_t *ops;
char *blocks[20000];
size_t *block_sizes;
} trace_t;
stats_t *stats;
/* Command-line options */
static int verbose = 1;
static double ftime_tolerance = 0.05;
static int dump = 0;
/*****************
* Range routines
*****************/
static range_t *ranges = NULL;
static range_t *garbage = NULL;
static trace_t *t = NULL;
/* Check if a pointer is 4-byte aligned */
#define IS_ALIGNED(p) ((((unsigned long)(p))%4) == 0)
int add_range (char *lo long size)
{
char *hi = lo + size - 1;
range_t *p;
assert(size > 0);
/* Check alignment */
if (!IS_ALIGNED(lo)) {
fprintf(stderr “Misaligned region returned\n“);
if (verbose)
fprintf(stderr “Address: %p\n“ lo);
return 0;
}
/* Region lies within heap */
if (lo < dseg_lo || lo > dseg_hi || hi < dseg_lo || hi > dseg_hi) {
fprintf(stderr “Region lies outside heap area\n“);
if (verbose) {
fprintf(stderr “Region: %p - %p\n“ lo hi);
fprintf(stderr “Heap: %p - %p\n“ dseg_lo dseg_hi);
}
return 0;
}
/* Region does not overlap any other region */
for (p = ranges; p != NULL; p = p->next) {
if ((lo >= p->lo && lo <= p-> hi) ||
(hi >= p->lo && hi <= p->hi)) {
fprintf(stderr “Region overlap detected\n“);
if (verbose) {
fprintf(stderr “Region 1: %p - %p\n“ lo hi);
fprintf(stderr “Region 2: %p - %p\n“ p->lo p->hi);
}
return 0;
}
}
/* Clobber region (zero miswritten control records) */
//bzero(lo size);
memset(lo 0 size);
p = (range_t *)malloc(sizeof(range_t));
p-> next = ranges;
p->lo = lo;
p->hi = hi;
ranges = p;
return 1;
}
void remove_range (char *lo)
{
range_t *p **prevpp = &ranges;
for (p = ranges; p != NULL; p = p->next) {
if (p->lo == lo) {
*prevpp = p->next;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-10-25 17:57 lab_garbage_collector\
文件 90890 2011-10-23 22:19 lab_garbage_collector\amptjp.dump
目录 0 2011-10-25 17:56 lab_garbage_collector\artificial\
文件 76355 2009-04-14 19:59 lab_garbage_collector\artificial\binary.rep
文件 156357 2009-04-14 19:59 lab_garbage_collector\artificial\binary2.rep
文件 134602 2009-04-14 19:59 lab_garbage_collector\artificial\coalescing.rep
文件 929 2009-04-14 19:59 lab_garbage_collector\artificial\gen_binary.pl.txt
文件 805 2009-04-14 19:59 lab_garbage_collector\artificial\gen_coalescing.pl
文件 1657 2009-04-14 19:59 lab_garbage_collector\artificial\gen_random.pl
文件 25341 2009-04-14 19:59 lab_garbage_collector\artificial\random.rep
文件 26323 2009-04-14 19:59 lab_garbage_collector\artificial\random2.rep
文件 116867 2011-10-23 22:19 lab_garbage_collector\binary.dump
文件 221348 2011-10-23 22:19 lab_garbage_collector\binary2.dump
文件 94963 2011-10-23 22:19 lab_garbage_collector\cccp.dump
文件 109117 2011-10-23 22:19 lab_garbage_collector\cp-decl.dump
目录 0 2011-10-25 17:56 lab_garbage_collector\Debug\
文件 41504 2011-10-25 17:54 lab_garbage_collector\Debug\driver.obj
文件 0 2011-10-25 17:54 lab_garbage_collector\Debug\driver.sbr
文件 6659 2011-10-22 16:02 lab_garbage_collector\Debug\dump.obj
文件 0 2011-10-22 16:02 lab_garbage_collector\Debug\dump.sbr
文件 10689 2011-10-22 16:02 lab_garbage_collector\Debug\ftime_win32.obj
文件 0 2011-10-22 16:02 lab_garbage_collector\Debug\ftime_win32.sbr
文件 2491392 2011-10-25 17:54 lab_garbage_collector\Debug\gc.bsc
文件 241764 2011-10-25 17:54 lab_garbage_collector\Debug\gc.exe
文件 372576 2011-10-25 17:54 lab_garbage_collector\Debug\gc.ilk
文件 247576 2011-10-25 17:54 lab_garbage_collector\Debug\gc.pch
文件 615424 2011-10-25 17:54 lab_garbage_collector\Debug\gc.pdb
文件 13845 2011-10-22 16:02 lab_garbage_collector\Debug\getopt.obj
文件 0 2011-10-22 16:02 lab_garbage_collector\Debug\getopt.sbr
文件 10562 2011-10-25 17:54 lab_garbage_collector\Debug\malloc.obj
文件 0 2011-10-25 17:54 lab_garbage_collector\Debug\malloc.sbr
............此处省略38个文件信息
相关资源
- BIOME-BGC-4.2
- SpringCloud 15个完整
- OpenStackCloudComputingCookbook.pdf 英文原版
- 格科微GC0403数据手册Datasheet
- 《OGC标准介绍》PDF版本
- LFMCW毫米波雷达回波信号仿真及AGC电路
- Gcode激光振镜
- 格兰杰因果分析工具箱介绍MVGC
- libiconv-1.14-sol10-x86-local.gz
- The Garbage Collection Handbook: the Art of Au
- gcc-4.9.0依赖包
- Gcc internals中文版
- 从零开始搭建SpringCloud第五节源码及截
- FX3S·FX3G·FX3GC·FX3U·FX3UC系列微型可编
- gcc-3.4-ubuntu.tar.gz
- GC2053_CSP_datasheet for release_Rev.1.0.pdf
- GNU GCC编译器手册
- SpringCloud201804.zip
- gcc-4.9.3 安装依赖组件 (以此为准)
- gcr1218_9916885.pdf
- springcloud全家桶(eureka+ribbon+feign+hys
- 数据统计分析工具软件gcluto大数据
- WGCNA Tutorial 注释
- mingw Minimalist GNUfor Windows 程序
- GNU MAKE源码
- 大规模风电并网的频率特性及AGC模型
- springcloud源码
- BGC2.2汉化调参版
- GCT(线性代数考研最强笔记)李永乐
- GTA5OL优化客戶端_MCGC.rar
评论
共有 条评论