Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig and Rust article malloc and stack mismatch #169

Open
grumbach opened this issue Dec 16, 2023 · 2 comments
Open

Zig and Rust article malloc and stack mismatch #169

grumbach opened this issue Dec 16, 2023 · 2 comments

Comments

@grumbach
Copy link

no programs understand what their stack usage is exactly
...
When we call malloc, we just hope that we have enough stack space for it, we almost never check.

Malloc is heap allocation not stack allocation. You probably meant memory space and not stack space.

@matklad
Copy link
Owner

matklad commented Dec 16, 2023

No, this is correct. Like any function, Malloy needs some amount of stack space for its local variables. Moreover, the stack usage of malloc tends to be comparatively high due to things like

https://github.com/aerospike/jemalloc/blob/05108b5010a511226fb7586543f4162dd2d31d2b/include/jemalloc/internal/rb.h#L467

@grumbach
Copy link
Author

Oh ok, I indeed didn't think of it that 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

No branches or pull requests

2 participants