|
|
|
|
|
by CyberDildonics
1922 days ago
|
|
I'm not even sure I understand what you are asking, do you think that memory allocation is always bumping a pointer a uniform amount with no memory being freed, no variance in allocation size and no interlaced lifetimes? You originally said that memory allocation was 'just a few instructions' when the reality is that it is complex and avoiding allocation is the first thing to do when optimizing software. Saying that memory allocation is simple and fast based on a scenario that should never happen because it's useless is a little silly. No, that is not how allocators work. |
|
In modern language implementations with moving collectors allocation is literally what I've described in the fast path. Not theoretical. That's literally the instructions used.
> You originally said that memory allocation was 'just a few instructions'
Here it is in a real industrial compiler and garbage collector, for example.
https://github.com/oracle/graal/blob/f9530b0948c58a66845e84f...
It's precisely as I've described.