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

Optimize memory initialization handling in AOT loader #4

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

no1wudi
Copy link
Collaborator

@no1wudi no1wudi commented Feb 19, 2025

Summary

  • Modify the AOT loader and AOT compilation code to optimize memory initialization handling
  • Change the AOTMemInitData structure to use a uint8 * type for the bytes field instead of a flexible array member
  • Update the destroy_mem_init_data_list and load_mem_init_data_list functions to handle new AOTMemInitData structure, including checking ownership of binary data before freeing it
  • This change reduces unnecessary memory allocation when the binary data can be directly referenced from the file buffer

Impact

  • Enhances memory efficiency by avoiding double memory allocation for data segments when the file buffer is guaranteed to persist
  • No functional changes - the existing behavior of loading and destroying memory initialization data is preserved
  • Improves maintainability by making the data structure and related functions more consistent and easier to understand

Save memory if the file buffer is always exist before exit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
@xiaoxiang781216 xiaoxiang781216 merged commit 9b11818 into open-vela:dev Feb 25, 2025
3 checks passed
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.

3 participants