The lost malloc()

(napcakes.nekoweb.org)

51 points | by matt_d 3 hours ago

3 comments

  • veltas 4 minutes ago
    I don't associate with the author that well here because I'm not hyped about 'arena allocators' and I don't really care that free doesn't receive a size. I think the interface was okay.

    Also 'arena allocators' (this meant something different like 20 years ago so I think the name just got rebranded) are not that good, they make some things easier and improve performance sometimes, they also are liable to use more memory and cause more fragmentation if not used with care. That is one of the many reasons why we slowly evolved away from the old linear allocators, but also because we just wanted a simple and flexible interface to hide complexity.

  • jdw64 2 hours ago
    When I was a college student (15 years ago), I first encountered C through A Book on C, and C seems like a language that is simple but can really do a lot. Looking at how old this language is, and how many concepts already used in modern languages were tried during its development history, is surprising. It's surprising that the concepts I thought were modern techniques today were already being tried decades ago—that is, before I was even born.

    It's amazing that a method like the Bump Allocator was already tried.

    How were the senior programmers able to do all of this? I'm just amazed.

    • saidnooneever 59 minutes ago
      if you write your program first with pencil and paper u'll be amazed at what you can do yourself.

      most people open an ide and start coding, or write some basic diagrams to get an overview/mental model. Back in the day any bitnlarge program would take hours to compile so really u did not want to have any bug or typo just to sit for hours until a compile error or logic mistake. Take it even further back to days before C and that is even more needed.

      a lot of high level modern languages seem to alleviate that need, likely so that enterprise software can be written a bit faster because the features need to arrive faster.

      still in more modern languages i'd recommend starting with pencil and paper, write most of it if not the whole thing out. u'll find much nicer patterns and will save yourself a bunch of refactoring. even for small programs.

      • lieks 19 minutes ago
        When I was at school, I used to program on paper like this (due to not having a computer during class). It was accidentally a great exercise, that I think everyone should try. Because of it, I find myself writing mostly bug-free code on my first try these days (my bugs tend to happen on interactions between parts of a system I designed separately).
    • trashb 1 hour ago

        > How were the senior programmers able to do all of this? I'm just amazed.
      
      I think it has to do with a combination of factors that changed over the years. First of all computer science was viewed more theoretical and less applied at that time. A computer scientist would be interested in optimizing a certain algorithm instead of making an app.

      Secondly the systems in that time where less complex meaning it was easier to understand and experiment with fundamental parts of the computer.

      Lastly at that time "programming" was closer to the metal so a average computer scientist at that time would likely have more knowledge of the deep internals compared to an average programmer today.

        > C seems like a language that is simple but can really do a lot
      
      I like to borrow a phrase from the realm of gaming: "easy to learn hard to master".
      • ahoka 1 hour ago
        I have always thought about C being a language with "simple" syntax (but things like type declarations are hell), but very complicated semantics.
    • Anon4Now 38 minutes ago
      > It's amazing that a method like the Bump Allocator was already tried.

      The old saying "Necessity is the mother of invention" applies. Smart people + system constraints => ingenuity.

  • paaloeye 2 hours ago
    Never seen a 4 points story on the front page.
    • meerita 1 hour ago
      These are the misteries of HN.
      • paaloeye 50 minutes ago
        I thought it was a mid-term election mystery
        • yorwba 14 minutes ago
          Maybe the midterms caused you to refresh the front page more often so that you noticed this post before it had been there long enough to get upvoted a lot. (The minimum to get on the front page is 2 upvotes.)