HNHacker News
TopNewBestAskShowJobs

omra

51 karma · joined August 16, 2012

submissionscomments
omra··on Interesting C Interview Questions and Answers
Generally modern operating systems free any memory left that the program is not using, but is still accessible. However, if you overwrite an old pointer, there is no way that the operating system could catch that.

To illustrate the difference, I wrote two quick programs.

This one has memory that the OS can recover:

        #include <stdlib.h>

        int main(void) {
                char *a = malloc(10);
                return 0;
        }
This one has memory that the OS cannot recover:

        #include <stdlib.h>

        int main(void) {
                char *a = malloc(10);
                a = malloc(10);
                return 0;
        }
omra··on Apple's Cap Reaches $621B, Now The Most Valuable Public Company Of All Time
I think that the labels for the graph have been swapped up. Microsoft (1999) and Microsoft (Current).
← PreviousPage 2 of 2