-
Notifications
You must be signed in to change notification settings - Fork 274
Description
我的使用场景是会同时创建大量协程,然后也会有大量释放,因为我们协程一直是保存在free_list里,导致内存始终是在一个高位,即使没什么负载的时候也是这样,对运维很困惑.所以就想把协程释放的同时内存也一起释放.
改动的地方在下面,不知道有什么问题,不管用mmap还是malloc模式,情况都是一样的
`/*
- Free the stack for the current thread
*/
void _st_stack_free(_st_stack_t ts)
{
if (!ts)
return;
_st_delete_stk_segment(ts->vaddr,ts->vaddr_size);
// / Put the stack on the free list */
// ST_APPEND_LINK(&ts->links, _st_free_stacks.prev);
// _st_num_free_stacks++;
}`
Program received signal SIGSEGV, Segmentation fault.
_int_free (av=0x7ffff7498760 <main_arena>, p=0xe5aff0, have_lock=0) at malloc.c:4010
4010 p->fd = fwd;
(gdb) bt
#0 _int_free (av=0x7ffff7498760 <main_arena>, p=0xe5aff0, have_lock=0) at malloc.c:4010
#1 0x0000000000687dfb in _st_delete_stk_segment (vaddr=0xe5b000 "8\217I\367\377\177", size=73728) at stk.c:157
#2 0x0000000000687db9 in _st_stack_free (ts=0xe50830) at stk.c:114
#3 0x0000000000686dfb in st_thread_exit (retval=0x0) at sched.c:303
#4 0x0000000000686ff0 in _st_thread_main () at sched.c:366
#5 0x000000000068784c in st_thread_create (start=0x5d584e SrsFastCoroutine::pfn(void*), arg=0x1e08400, joinable=1, stk_size=65536) at sched.c:694