云风

Results 174 comments of 云风

我不清楚你是怎么弄出这个问题出来的,实际上这里 skynet 改写了 malloc ,是自己的实现,理论上不应该受 libc 的检查约束。因为这块内存本身就不是由 libc 直接管理的。 而你如果想直接用 CRT 的 malloc ,那么应该定义宏 `NOUSE_JEMALLOC` 。这样,以上整个函数都不会被编译进去。 所以,我怀疑你是在编译链接环节出了问题,导致链接了多份不同的 malloc 。

我看 man 上写 > This function is intended to only be used for diagnostics and statistics; writing to the excess memory without first calling realloc(3) to resize the allocation is...

https://github.com/cloudwu/skynet/commit/6a7043cfac0c64d505351283957c9854165f22db 已改。 我觉得完全去掉 `je_malloc_usable_size` 更干净。至于统计,这个值本来就是一个参考值,使用 `je_malloc_usable_size` 也没有准确多少。如果是想查询真实占用,应该使用 jemalloc 提供的 info 信息,目前也可以在 skynet console 查到。

> 不应该是 fill_prefix(ptr, n * size, cookie_n * size) 吗 @_@ 对。抱歉,在写别的程序,刚才没仔细看。

cc @junjie020

cc @pourtheworld

See https://github.com/ejoy/ant/discussions/136