TinySTL icon indicating copy to clipboard operation
TinySTL copied to clipboard

chunk_alloc第二级配置器的问题

Open ArthurDax opened this issue 2 years ago • 1 comments

if (!start_free){ obj **my_free_list = 0, *p = 0; for (int i = 0; i <= EMaxBytes::MAXBYTES; i += EAlign::ALIGN){ my_free_list = free_list + FREELIST_INDEX(i); p = *my_free_list; if (p != 0){ *my_free_list = p->next; start_free = (char *)p; end_free = start_free + i; return chunk_alloc(bytes, nobjs); } } end_free = 0; } heap_size += bytes_to_get; end_free = start_free + bytes_to_get; return chunk_alloc(bytes, nobjs);

当第二级配置器无法在free_list中找到空闲内存时,end_free=0,与《STL源码剖析》对比没有 image 这样当无可用内存就不会抛出异常,end_free = start_free + bytes_to_get;,会造成错误的水位标识?

ArthurDax avatar Oct 09 '22 01:10 ArthurDax

邹晓航已经收到了你发送的邮件~~

zouxiaohang avatar Oct 09 '22 01:10 zouxiaohang