Lurker News

Comments (218) 56 threads

Show all comments

Showing thread 15 of 56

jll291 reply#
Thanks for sharing; small is beautiful. A couple of points of feedback:

- check return value from malloc();
- consider using your own arena allocator (which gets a larger block of memory with a one-time call of malloc, then calls an in-process allocator that assigns part of that block);
- use a library prefix e.g. Lavandula_ before API functions like get() or runApp() to avoid name collisions.
- The JSON function is not spec-compliant; why not use an existing library? (I understand external dependecies may introduce unwanted bloat, but in this case, there are many compact and efficient options.)

1718627440#
> consider using your own arena allocator (which gets a larger block of memory with a one-time call of malloc, then calls an in-process allocator that assigns part of that block);

This is what malloc already does. Unless you intend to have multiple different arenas in your program, this is just unnecessary complexity.