以下程序不会触发断言失败:
int main(int argc, char **argv)
{
int * n = (int *)malloc(100);
//malloc_stats_print(nullptr, nullptr, "gablh");
free(n);
*n += 1;
std::cerr << *n << std::endl;
for (int i = 0; i != 10; ++i) {
std::cerr << *(n+i) << std::endl;
}
}
当我运行程序时
MALLOC_CONF="quarantine:32,abort:true,stats_print:true" ex_stats_pr
我得到:
1515870811
1515870811
1515870810
1515870810
1515870810
1515870810
1515870810
1515870810
1515870810
1515870810
1515870810
有没有办法用 jemalloc 触发中止失败?