程序的结构是 +------+ |Parent|------------>死亡 +------+ | |-------[fork()]---->子进程 1------->死亡 | |-------[fork()]---->子进程 2------->死亡 | .... .... | |-------[fork()]---->子进程 n------->死亡
测试的时候Parent进程没有问题,然而三个子进程每一个都报告: MEMWATCH detected 1 anomalies
但是memWatch.log文件里面的日志又是: 引用:
============= MEMWATCH 2.71 Copyright (C) 1992-1999 Johan Lindh =============
Started at Sun Jan 30 00:43:47 2005
Modes: __STDC__ 32-bit mwDWORD==(unsigned long) mwROUNDALLOC==4 sizeof(mwData)==32 mwDataSize==32
overflow: <10> dirnanny.c(312), 9 bytes alloc'd at <9> dirnanny.c(307)
============= MEMWATCH 2.71 Copyright (C) 1992-1999 Johan Lindh =============
Started at Sun Jan 30 00:43:47 2005
Modes: __STDC__ 32-bit mwDWORD==(unsigned long) mwROUNDALLOC==4 sizeof(mwData)==32 mwDataSize==32
overflow: <10> dirnanny.c(312), 9 bytes alloc'd at <9> dirnanny.c(307)
============= MEMWATCH 2.71 Copyright (C) 1992-1999 Johan Lindh =============
Started at Sun Jan 30 00:43:47 2005
Modes: __STDC__ 32-bit mwDWORD==(unsigned long) mwROUNDALLOC==4 sizeof(mwData)==32 mwDataSize==32
overflow: <10> dirnanny.c(312), 9 bytes alloc'd at <9> dirnanny.c(307)
============= MEMWATCH 2.71 Copyright (C) 1992-1999 Johan Lindh =============
Started at Sun Jan 30 00:43:47 2005
Modes: __STDC__ 32-bit mwDWORD==(unsigned long) mwROUNDALLOC==4 sizeof(mwData)==32 mwDataSize==32
Stopped at Sun Jan 30 00:43:47 2005
Memory usage statistics (global): N)umber of allocations made: 4 L)argest memory usage : 80 T)otal of all alloc() calls: 132 U)nfreed bytes totals : 0
Stopped at Sun Jan 30 00:44:47 2005
Memory usage statistics (global): N)umber of allocations made: 6 L)argest memory usage : 118 T)otal of all alloc() calls: 170 U)nfreed bytes totals : 0
Stopped at Sun Jan 30 00:44:47 2005
Memory usage statistics (global): N)umber of allocations made: 6 L)argest memory usage : 125 T)otal of all alloc() calls: 177 U)nfreed bytes totals : 0
Stopped at Sun Jan 30 00:44:51 2005
Memory usage statistics (global): N)umber of allocations made: 6 L)argest memory usage : 127 T)otal of all alloc() calls: 179 U)nfreed bytes totals : 0
显示的四个进程都没有问题,Unfreed bytes total这一项都是0
我就不明白了,这到底是有没有内存遗漏呢?
|