Skip to content

Reduce the stack usage of fwrite() - #161

Open
rosenrost wants to merge 1 commit into
freemint:masterfrom
rosenrost:fix/reduce-the-stack-usage-of-fwrite
Open

rosenrost wants to merge 1 commit into
freemint:masterfrom
rosenrost:fix/reduce-the-stack-usage-of-fwrite

Conversation

@rosenrost

Copy link
Copy Markdown
Contributor

In text mode, fwrite() allocated an 8 KB buffer on the stack to insert carriage returns. Programs running with a small stack (_stksize), e.g. accessories, can overflow their stack with that. As the data is written in chunks of the buffer size anyway, a 512 byte buffer only costs a few more Fwrite() calls for large writes.

In text mode, fwrite() allocated an 8 KB buffer on the stack to insert
carriage returns. Programs running with a small stack (_stksize), e.g.
accessories, can overflow their stack with that. As the data is
written in chunks of the buffer size anyway, a 512 byte buffer only
costs a few more Fwrite() calls for large writes.
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