68
BigBoo
6d

How malloc works? It's easy. Just follow this simple flowchart and you will understand in no time.

Comments
  • 8
    Higher res version of said flowchart.

    https://raw.githubusercontent.com/c...
  • 2
    Memory management in C is a nightmare when it comes to fragmentation, especially in an embedded system. There are ways around it, like reserving large, medium and small chunks. Then you have to manage the whole damn thing.
  • 2
    @electric-ghost I'm trying to figure out why, according to this flowchart, it's legal to do.

    free(a);
    free(b);
    free(a);

    But not

    free(a);
    free(a);

    I know that it works this way, but can't find out why.
  • 6
    The tags, though.
  • 3
    @GMR516 Rightly brought up
  • 4
    @GMR516 I'm a rebel.

    Was pretty sure I removed the first tag. But I'm willing to roll with being ambiguous.
Your Job Suck?
Get a Better Job
Add Comment