• qaz@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      Doesn’t that make it slower because it needs to zero out all the bytes first?

      • rothaine@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        24 hours ago

        My understanding is that it’s only slightly slower: the OS maintains a pool of zeroed pages anyway, so it’s not like your program has to iterate over all the addresses and write to them.

        But it’s been a long time since I’ve done any C/C++ so I could be wrong.

        • qaz@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          23 hours ago

          the OS maintains a pool of zeroed pages

          TIL, I didn’t know that.