if you ever tried to write a memory manager (which you have to if you work somewhere like Microsoft and you're making something like Windows, for example), you must've run into the problem that the amount of space needed does not always align neatly with the blocks available.

to take a simple example

suppose half your computer's memory is taken up by a program except for a small bit in the middle. so it's technically using a little under half.

and some program is requesting a big block that's a bit over half.

well, it can't have that, because there is no block that size... except if that spare middle block was eliminated somehow.

which would mean moving one entire half of the memory of the program... which is in the middle of something.

memory management is complex.

Follow

@thor Moreover you may not WANT to move it... Generally if you have the memory to spare you want to pre-allocate more memory than a program needs to it isnt constantly allocating in small chunks.. Therefore a block of free memory within the memory allocated to a program may be intentional and a feature.

This can improve performance by many orders of magnitude.. one such pre-allocation system I know of is 30x faster than direct system allocation as-needed (in one such benchmark)

@freemo reminds me a bit of a guy who was new to writing software for ballistic missiles

"wait, there's no memory management here"

the veterans: the missile will be dust once it hits the target. we just chuck enough RAM in it to last until it goes kaboom and ignore memory management.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.