• helenslunch@feddit.nl
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    5 months ago

    I mean what differences does it make if it’s needed or not if it’s not in use?

    • bamboo@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      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.