我在以下地图中存储了大约 14GB 的数据:
struct data
{
char* a;
char* b;
data(char* _a, char* _b)
{
int alen = strlen(a);
a = new char[alen+1];
strcpy(a,_a);
a[alen]='\0';
int blen = strlen(_b);
b = new char[ blen+1];
strcpy(b,_b);
b[blen]='\0';
}
~data()
{
delete [] a;
delete [] b;
}
};
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
map<const char*, data*, ltstr> m;
程序运行一定数量的记录(26293289 中的 10440440),一段时间后我收到以下错误消息。
Program terminated with signal SIGKILL, Killed.
The program no longer exists.
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.25.el6.x86_64 libgcc- 4.4.5-6.el6.x86_64 libstdc++-4.4.5-6.el6.x86_64
我怎样才能避免上述终止?
服务器规格:
Mem: 24605344k total, 15148556k used, 9456788k free, 20892k buffers
Swap: 2097144k total, 161364k used, 1935780k free, 14469244k cached