Hacker News new | ask | show | jobs
by junon 1125 days ago
Seems to be a bug on the first interactive graph, at least for me. Unless I'm misunderstanding the point of the graph, `malloc(7)` only allocates 2 bytes.
2 comments

I came here to see if anyone else noticed this and am confirming that there is a bug in the first slider on malloc(7). Indeed it only allocates two bytes instead of seven.
Good spot! Thank you. Fix on its way out now. :)
Thank you for building this! It's helped a lot for me to wrap my head around the concept even more deeply than before.
True, it might be cut-off from screen?
Nah, I just failed at basic arithmetic :D

I wrote this:

  <div class="memory" bytes="32">
    <malloc size="4" addr="0x0"></malloc>
    <malloc size="5" addr="0x4"></malloc>
    <malloc size="6" addr="0x9"></malloc>
    <malloc size="7" addr="0xa"></malloc>
    <free addr="0x0"></free>
    <free addr="0x4"></free>
    <free addr="0x9"></free>
    <free addr="0xa"></free>
  </div>

Instead of this:

  <div class="memory" bytes="32">
    <malloc size="4" addr="0x0"></malloc>
    <malloc size="5" addr="0x4"></malloc>
    <malloc size="6" addr="0x9"></malloc>
    <malloc size="7" addr="0xf"></malloc>
    <free addr="0x0"></free>
    <free addr="0x4"></free>
    <free addr="0x9"></free>
    <free addr="0xf"></free>
  </div>