Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分配器问题 #16

Open
boscotsang opened this issue May 24, 2016 · 4 comments
Open

分配器问题 #16

boscotsang opened this issue May 24, 2016 · 4 comments

Comments

@boscotsang
Copy link

Alloc.cpp 的103行开始对malloc分配失败的分支进行处理,遍历所有已有的free obj查看有无可用的free obj,其中for循环应该从i等于bytes开始,因为小于bytes的obj肯定不能满足,然后如果都没有可用的链表,tinystl依然默认其分配成功,并且最后将heap_size加上bytes_to_get和调用chunk_alloc可能导致无限调用

@iEternity
Copy link

iEternity commented Nov 8, 2017

确实有这个问题,alloc::chunk_alloc函数中
for (int i = 0; i <= EMaxBytes::MAXBYTES; i += EAlign::ALIGN)这一行应该改为:
for (int i = bytes; i <= EMaxBytes::MAXBYTES; i += EAlign::ALIGN)
@zouxiaohang

@douysu
Copy link

douysu commented Sep 14, 2021

我也发现这个问题了

@lin-rany
Copy link

lin-rany commented Feb 1, 2022

对的,如果所有free obj都不可用。应该尝试out of memory机制。

@zouxiaohang
Copy link
Owner

zouxiaohang commented Feb 1, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants