TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What Is in a Rust Allocator?

94 点作者 sulami大约 1 年前

1 comment

tialaramex大约 1 年前
I have never investigated why, but each time I look at this API it strikes me that the allocator isn&#x27;t allowed to tell you how much space it <i>actually</i> gave you.<p>Suppose I&#x27;m an allocator which only has power-of-2 sized spaces to hand out, and you&#x27;re a growable array type and you want enough space for 20 of your 52 byte entries. So that&#x27;s 20x52 = 1040 bytes, but my smallest suitable space is 2048 bytes. I can give you that space, but it seems like it&#x27;d be nice for me to say oh, here&#x27;s 2048 bytes, and now the growable array type knows its new total capacity is not 20 but 39.
评论 #40285532 未加载
评论 #40284521 未加载
评论 #40284510 未加载
评论 #40284671 未加载
评论 #40284785 未加载
评论 #40284657 未加载