简体   繁体   中英

When to use custom allocator

I have 3 types of allocators, but I can't understand when to use custom allocators :

Linear Allocator
Stack Allocator
Pool Allocator

How that allocators work?

You use custom allocators when you have evidence that C++'s default allocators are insufficient for the task at hand. One of the more common places you'll see this is in game development, where maintaining a highly organized, compacted memory footprint helps with performance. The allocators you mention are all ways of shaping these allocations, generally with a view towards reducing fragmentation, improving locality of reference, working set issues, and the like.

Edit: I need 23 more rep to comment. I will refactor this as a comment when I have achieved this milestone, since it's not really an answer, and your question is a bit too broad as is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM