当前位置: 技术问答>linux和unix
网上一个Linux内存泄漏检测工具MemSnapShot.cpp在Hp Unix 下报的错!
来源: 互联网 发布时间:2016-04-25
本文导语: /*********************************************************************************** * filename : MemSnapShot.cpp * author : mjguan * date : 2003/04/22 * description : receive message( data ) from the message queue, and analysis it. * * 1. 使用curs...
/***********************************************************************************
* filename : MemSnapShot.cpp
* author : mjguan
* date : 2003/04/22
* description : receive message( data ) from the message queue, and analysis it.
*
* 1. 使用curses库写屏幕后,应该调用refresh()来刷新。
***********************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define _XOPEN_SOURCE_EXTENDED
#include
#define SINGLE_NEW 0x00 // indicate alloc memory with new type
#define ARRAY_NEW 0x01 // indicate alloc memory with new[] type
#define SINGLE_DELETE 0x02 // indicate free memory with delete type
#define ARRAY_DELETE 0x03 // indicate free memory with delete[] type
#define FILENAME_LENGTH 32 // the filename length
#define MEMORY_INFO 0X12345678 // indicate the message type on the message queue
typedef struct
{
char Filename[ FILENAME_LENGTH ]; // new所在的源程序文件名
unsigned long LineNum; // new在源文件中的行号
size_t AllocSize; // 分配的内存大小
int OperationType;
void * pBuffer; // 分配后得到的内存指针
short errCode; // 0 - 没有释放, 1 - delete了new[]分配的内存
}MemOperation;
typedef struct
{
int Type; // message type, in this module must be MEMORY_INFO
MemOperation Data; // content of memory operation
} MsgBuffer;
typedef struct
{
char Filename[ FILENAME_LENGTH ];
unsigned long LineNum;
void *MemoryPtr;
int OperationType;
unsigned long TotalSize;
} StatResult;
int nMsgQueue; // message queue id
int interval = 1;
pid_t pid = 0;
map mapMemory;
list listMemory;
pthread_mutex_t mutexMap;
extern int errno;
pthread_t tid1, tid2, tid3;
unsigned long int totalLeak = 0;
WINDOW *win;
void *AnalyseMessage( void * );
void *DisplayStatResult( void * );
void *MonitorKeyboard( void * );
void initial();
void popWin( char *str );
void DecodeErr( int ErrNum );
* filename : MemSnapShot.cpp
* author : mjguan
* date : 2003/04/22
* description : receive message( data ) from the message queue, and analysis it.
*
* 1. 使用curses库写屏幕后,应该调用refresh()来刷新。
***********************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define _XOPEN_SOURCE_EXTENDED
#include
#define SINGLE_NEW 0x00 // indicate alloc memory with new type
#define ARRAY_NEW 0x01 // indicate alloc memory with new[] type
#define SINGLE_DELETE 0x02 // indicate free memory with delete type
#define ARRAY_DELETE 0x03 // indicate free memory with delete[] type
#define FILENAME_LENGTH 32 // the filename length
#define MEMORY_INFO 0X12345678 // indicate the message type on the message queue
typedef struct
{
char Filename[ FILENAME_LENGTH ]; // new所在的源程序文件名
unsigned long LineNum; // new在源文件中的行号
size_t AllocSize; // 分配的内存大小
int OperationType;
void * pBuffer; // 分配后得到的内存指针
short errCode; // 0 - 没有释放, 1 - delete了new[]分配的内存
}MemOperation;
typedef struct
{
int Type; // message type, in this module must be MEMORY_INFO
MemOperation Data; // content of memory operation
} MsgBuffer;
typedef struct
{
char Filename[ FILENAME_LENGTH ];
unsigned long LineNum;
void *MemoryPtr;
int OperationType;
unsigned long TotalSize;
} StatResult;
int nMsgQueue; // message queue id
int interval = 1;
pid_t pid = 0;
map mapMemory;
list listMemory;
pthread_mutex_t mutexMap;
extern int errno;
pthread_t tid1, tid2, tid3;
unsigned long int totalLeak = 0;
WINDOW *win;
void *AnalyseMessage( void * );
void *DisplayStatResult( void * );
void *MonitorKeyboard( void * );
void initial();
void popWin( char *str );
void DecodeErr( int ErrNum );
|
mapMemory.erase( record );
错误提示说得比较明白吧
Warning 134: "MemSnapShot.cpp", line 278 # Expected 0 arguments for macro 'erase'.
mapMemory.erase( record );
^^^^^
Error 19: "MemSnapShot.cpp", line 278 # Unexpected '('.
mapMemory.erase( record );
看上去erase这个方法不需要参数啊
错误提示说得比较明白吧
Warning 134: "MemSnapShot.cpp", line 278 # Expected 0 arguments for macro 'erase'.
mapMemory.erase( record );
^^^^^
Error 19: "MemSnapShot.cpp", line 278 # Unexpected '('.
mapMemory.erase( record );
看上去erase这个方法不需要参数啊
|
好长。。。
逐条按照错误去检查
俺的是FC非HP,无法还原你的问题。
good luck!
逐条按照错误去检查
俺的是FC非HP,无法还原你的问题。
good luck!
|