Bad memory management can actually slow down applications significantly. Allocating memory is actually a fairly expensive operation. So much that high performance software actually uses a bunch of tricks to avoid extra allocations where possible. Additionally, accessing memory is actually kinda slow for a CPU, and the CPU often has to sit around for many clock cycles waiting for memory to be retrieved if it’s not in the CPU’s cache. If your main data can be stored more compactly, more of that data can fit in your CPU’s cache, reducing that idle time.
I mean what differences does it make if it’s needed or not if it’s not in use?
Bad memory management can actually slow down applications significantly. Allocating memory is actually a fairly expensive operation. So much that high performance software actually uses a bunch of tricks to avoid extra allocations where possible. Additionally, accessing memory is actually kinda slow for a CPU, and the CPU often has to sit around for many clock cycles waiting for memory to be retrieved if it’s not in the CPU’s cache. If your main data can be stored more compactly, more of that data can fit in your CPU’s cache, reducing that idle time.
Who said anything about “bad” memory management?
Bad memory management includes allocating memory you aren’t actually making use of.
How is that bad?
Try reading two posts of mine up where I explained it