TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What Is in a Rust Allocator?

94 pointsby sulamiabout 1 year ago

1 comment

tialaramexabout 1 year ago
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 未加载