Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Is OS wasting memory?

  1. Sep 30, 2009 #1
    I did a quick experiment. First I compiled a simple hello world program in C++ , using a gcc compiler. The source code is 100 bytes, but the executable file it 9.6 kb.

    Then I dumbed the executable into hex using xxd, to check up on the 0s and 1s. It turns out there is a huge gap, almost a kilobyte long of zeros.

    I'm wondering if this is some sort of delay, or just unused bits?
  2. jcsd
  3. Oct 1, 2009 #2


    Staff: Mentor

    I'm guessing that the section with 0s is the data segment of your program, and that unless you specify otherwise, it will allocate a 1K block for it. I don't have any experience with gcc, so don't know if you can configure it to use less memory. Check the docs for gcc.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Is OS wasting memory?
  1. Memory Management (Replies: 3)

  2. Memory addresses (Replies: 7)

  3. Chromium OS (Replies: 8)

  4. Associative MEmory (Replies: 9)

  5. Programming an os (Replies: 23)