Comments (1)
Hey,
Thank you for the kind words. I did this project a while ago and I can't believe people still find it useful.
You're right about everything you said. The arena or other custom allocators work by doing fewer malloc calls (usually on startup) and then managing the memory by themselves, instead of doing a malloc every time. It is effectively one memory tool on top of another.
Why we need an additional memory tool on top of malloc? Malloc performance is not terrible but it's a bit inconsistent and sometimes it can be really slow. Malloc usually takes the memory from the user/app space if there's some available but if there's not, it needs to do system/OS call to request for more memory. This operation requires to switch the context (from user to OS and the back again to user). This is absurdly slow. The point of doing fewer mallocs, specially at start up is to reduce these slow operations, we'll do them once and that's it. After that, our allocations will be super fast.
Why the OS doesn't do that for us? Well, because it doesn't know how much memory our program will use but we do, or at least we have a rough idea. Having this information, allows us to allocate the memory in advance for our custom allocator and save syscalls.
I am no expert in this matter, so I suggest you to research about this interesting topic,
All the best,
Mariano.
from memory-allocators.
Related Issues (20)
- Can you share rest ppt of Dynamic memory ? HOT 2
- FreeListAllocator :: FindBest() question HOT 1
- I made mistake, sorry
- Bug in Free List Allocator on 32bit systems HOT 3
- Build errors HOT 3
- How to use allocated memory HOT 3
- why use virtual method HOT 1
- find a small bug here HOT 2
- Make AllocationHeader::padding size_t
- StackAllocator is not performant and wastes memory on padding
- Optimize PoolAllocator initialization by adding an Offset variable?
- Found a bug in StackAllocator
- Can't compile the code. HOT 4
- Question about FreeListAllocator HOT 2
- add simple example HOT 1
- Error while compiling in MSVC HOT 3
- consider adding tests HOT 1
- AllocationHeader is not copied from stack to the memory position HOT 2
- Potential infinite loop caused by linked list node pointing to itself HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memory-allocators.