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

Update memory allocation functions to use allocator user data #4043

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

lum1n0us
Copy link
Collaborator

fix #4024

Copy link
Collaborator

@loganek loganek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a note here, should we add WASM_MEM_ALLOC_WITH_USER_DATA to a deprecation list and remove it on the next API break? Not sure if having this option disabled causes any performance issues, and I think we could improve the readability of the code by not having yet another configuration option.

@lum1n0us
Copy link
Collaborator Author

FYI: the initial concept

However, I agree with the idea of combining WASM_MEM_ALLOC_WITH_USAGE and WASM_MEM_ALLOC_WITH_USER_DATA. @dongsheng28849455 and @wenyongh , please share your thoughts.

@dongsheng28849455
Copy link
Contributor

I agree with the merger, and it need to be informed that the custom allocator may need to consider compatibility issue.

@lum1n0us
Copy link
Collaborator Author

@loganek about " add WASM_MEM_ALLOC_WITH_USER_DATA to a deprecation list". I observed that there are no definitions for malloc_func, realloc_func, and free_func in wasm_export.h. Therefore, we can't use the gcc deprecated attribute as we normally would to indicate deprecation. My thought is to revise the comments above malloc_func to reflect this, but I'm uncertain if that aligns with the deprecated list you were referring to. Please share your suggestions on how to proceed.

Copy link
Collaborator

@TianlongLiang TianlongLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@loganek
Copy link
Collaborator

loganek commented Feb 5, 2025

@loganek about " add WASM_MEM_ALLOC_WITH_USER_DATA to a deprecation list". I observed that there are no definitions for malloc_func, realloc_func, and free_func in wasm_export.h. Therefore, we can't use the gcc deprecated attribute as we normally would to indicate deprecation. My thought is to revise the comments above malloc_func to reflect this, but I'm uncertain if that aligns with the deprecated list you were referring to. Please share your suggestions on how to proceed.

@lum1n0us I didn't necessarily mean to add the deprecation attribute (although it'd be nice) but more to maintain a list of things to deprecate on the next breaking-API release (e.g. WAMR 3.x) so we can bundle all the breaking changes together and don't forget about this one.
It could either be a github issue or maybe a wiki page (so others can add to that list if needed).

Copy link
Collaborator

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l

@lum1n0us lum1n0us merged commit 376385c into bytecodealliance:main Feb 6, 2025
385 checks passed
@lum1n0us lum1n0us deleted the fix/apply_user_data branch February 6, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing UserData in LinearMemory for custom allocator
5 participants