3 ms·
..."request-based memory arena"... there are some very questionable things going on with the memory handing in this code. just saying.
by Snuggly73 2y ago
..."request-based memory arena"...
there are some very questionable things going on with the memory handing in this code. just saying.
- williamcotton 2y agoRequest-based memory arenas are pretty standard for web servers!
- Snuggly73 2y agoMaybe be, after all - I dont write web servers (btw, the PQ and JQ libraries doesnt seem to use the arena allocator, which makes the whole proposition a bit dubious, but lets say that its me being picky). What I meant was, that IMO the code is not very robust when dealing with memory allocations: 1. The "string builder" for example silently ignores allocation failures and just happily returns - https://github.com/williamcotton/webdsl/blob/92762fb724a90354e5a079c42908d39da9ea39cb/src/stringbuilder.c#L44 https://github.com/williamcotton/webdsl/blob/92762fb724a9035... 2. In what seems most of the places, the code simply doesnt check for allocation failures, which leads to overruns (just couple of examples): https://github.com/williamcotton/webdsl/blob/92762fb724a90354e5a079c42908d39da9ea39cb/src/server/css.c#L12 https://github.com/williamcotton/webdsl/blob/92762fb724a9035... https://github.com/williamcotton/webdsl/blob/92762fb724a90354e5a079c42908d39da9ea39cb/src/server/routing.c#L62 https://github.com/williamcotton/webdsl/blob/92762fb724a9035...
- williamcotton 2y agoThanks for digging in. Yup, those two libs don’t support custom allocators. I raised an issue in the jq repo to ask if they thought about adding it. Great points about happy path allocations. If I ever touch the project again I’ll check each location. Note to self: free code reviews of projects if you mention LLMs!
- namaria 2y ago"People took a cursory look at a codebase I published and found glaring mistakes they discussed publicly as examples of how bad it is" is not the flex you think it is.
- williamcotton 2y ago"Cursory", get it? I did indeed make it with Cursor! ;) I hope you find yourself having a better day today than yesterday.
- namaria 2y agoI hope you stop peddling AI slop