Skip to content

Only increase the size of the stack if required#671

Open
tessereth wants to merge 1 commit into
vmg:masterfrom
tessereth:fix-stack-allocation
Open

Only increase the size of the stack if required#671
tessereth wants to merge 1 commit into
vmg:masterfrom
tessereth:fix-stack-allocation

Conversation

@tessereth

Copy link
Copy Markdown

Hi! I was looking through this code for unrelated reasons and happened to notice that redcarpet_stack_push is calling redcarpet_stack_grow significantly more often than necessary. My assumption from reading the code is that it should only allocate more memory if their's insufficient space but this is increasing the buffer size on every push so there's always double the space required.

Your contributing guide says to add a test but as far as I can tell there's no way to test C code directly so I'm not sure that's a feasible thing to do in this case. Please let me know if there is a way to test this and I'd be happy to add it. This does not appear to effect the benchmark in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant