Is there any book about memory allocators ?
Re: Is there any book about memory allocators ?
We have, I think, decided that the book is useless unless you've written it yourself.
Re: Is there any book about memory allocators ?
Atomic publishing protocol is easy. It's the cleanup afterwards that gets hairy.Dio wrote:The ones you can do with a single atomic substitution are workable, but frankly I'm done with anything else.
- gilesgoat
- Sheepie Whore

- Posts: 27258
- Joined: Wed Sep 03, 2003 7:54 am 0
- Location: Monfalcone, Italy
- Contact:
Re: Is there any book about memory allocators ?
Then when I'll be fully done I should write a PDF paper "About Giles' mem allocator" ?venusian wrote:We have, I think, decided that the book is useless unless you've written it yourself.
Giles the billy goat
"Baa"
"Baa"
- Little stoned kiwi
- Baaaaaa!

- Posts: 4597
- Joined: Mon Oct 27, 2003 6:05 am 0
- Location: Christchurch
Re: Is there any book about memory allocators ?
Post your self-documenting code to GitHub.
If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy.
- gilesgoat
- Sheepie Whore

- Posts: 27258
- Joined: Wed Sep 03, 2003 7:54 am 0
- Location: Monfalcone, Italy
- Contact:
Re: Is there any book about memory allocators ?
FUCK GITHUB !Little stoned kiwi wrote:Post your self-documenting code to GitHub.
Giles the billy goat
"Baa"
"Baa"
Re: Is there any book about memory allocators ?
What isn't obvious to me is what the allocator is supposed to be for.
Standard library allocators are hard to beat for general purpose use, and tuning tends to be a matter of improving performance for one set of use cases at the expense of others.
Special purpose allocators are a different matter, but they tend to come with constraints. e.g. you use arena allocators for temporary working sets, slab allocators if you are creating lots of recyclable objects of the same size, free lists if you want to recycle them etc.
Then of course there are other considerations. For example, a simple 2 page compacting garbage collector will work fine with any old arena allocator but if you are sweeping instead then you need to care about fragmentation.
Many of the general purpose allocators tend to be hybrids with structures optimised for different allocation patterns. Any old data structures book will get you the basics but making it work well is all about fine details.
Me? I use the default allocators for about 99% of my code, with custom allocators plugged in very occasionally for special circumstances. Only where the profiler has told me the code needs attention.
C++17 pmr stuff gives a mechanisms to plug allocators into most standard containers, along with a grab bag of the more useful special purpose types.
Standard library allocators are hard to beat for general purpose use, and tuning tends to be a matter of improving performance for one set of use cases at the expense of others.
Special purpose allocators are a different matter, but they tend to come with constraints. e.g. you use arena allocators for temporary working sets, slab allocators if you are creating lots of recyclable objects of the same size, free lists if you want to recycle them etc.
Then of course there are other considerations. For example, a simple 2 page compacting garbage collector will work fine with any old arena allocator but if you are sweeping instead then you need to care about fragmentation.
Many of the general purpose allocators tend to be hybrids with structures optimised for different allocation patterns. Any old data structures book will get you the basics but making it work well is all about fine details.
Me? I use the default allocators for about 99% of my code, with custom allocators plugged in very occasionally for special circumstances. Only where the profiler has told me the code needs attention.
C++17 pmr stuff gives a mechanisms to plug allocators into most standard containers, along with a grab bag of the more useful special purpose types.
- Little stoned kiwi
- Baaaaaa!

- Posts: 4597
- Joined: Mon Oct 27, 2003 6:05 am 0
- Location: Christchurch
Re: Is there any book about memory allocators ?
But memory allocators you and others submit trains Copilot to help people writing their own memory allocators.gilesgoat wrote: FUCK GITHUB !
If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy.
Re: Is there any book about memory allocators ?
It's true. All the most reliable memory data structure code comes from stackoverflow or copilot.Little stoned kiwi wrote:But memory allocators you and others submit trains Copilot to help people writing their own memory allocators.gilesgoat wrote: FUCK GITHUB !
- Little stoned kiwi
- Baaaaaa!

- Posts: 4597
- Joined: Mon Oct 27, 2003 6:05 am 0
- Location: Christchurch
Re: Is there any book about memory allocators ?
Especially stack overflow. Peer reviewed, init?
If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy.
- Little stoned kiwi
- Baaaaaa!

- Posts: 4597
- Joined: Mon Oct 27, 2003 6:05 am 0
- Location: Christchurch
Re: Is there any book about memory allocators ?
Part of me wants to use Copilot to write a memory allocator on a public GitHub that I link to asking for contributions and feedback at stack overflow and Reddit.
If they think you're crude, go technical; if they think you're technical, go crude. I'm a very technical boy.

