-
-
Notifications
You must be signed in to change notification settings - Fork 154
renderer: add custom allocator option #3859
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
base: main
Are you sure you want to change the base?
Conversation
fd32c38
to
2b5849f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements custom memory allocator support for ThorVG, allowing users to override default malloc/free functions by specifying a custom header file via meson configuration. This addresses the first part of feature request #3857.
- Adds a new
tvgAllocator.h
header that defines TVG_* memory allocation macros with fallback to standard library functions - Updates the memory allocation wrapper functions in
tvgCommon.h
to use the new TVG_* macros instead of std:: functions - Introduces a meson build option
custom_allocator_header
for specifying custom allocator implementations
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
src/renderer/tvgAllocator.h | New header defining TVG_* memory allocation macros with custom allocator support |
src/renderer/tvgCommon.h | Updated to use TVG_* macros instead of std:: memory functions |
meson_options.txt | Added custom_allocator_header option for specifying custom allocator header path |
meson.build | Added configuration logic for custom allocator feature and build summary |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This commit resolves the first part of the feature request thorvg#3857 . User in theory can bring their own allocator by using `meson setup builddir -Dcustom_allocator_header=/path/to/your_own_alloc.h`, and then provide the TVG_{MALLOC|CALLOC|REALLOC} macros.
2b5849f
to
69dd9f2
Compare
@hermet Done, please proceed review, thanks |
Here's an example of ESP-IDF port: https://github.com/huming2207/esp-thorvg But somehow if the multithreading is enabled and the Meanwhile @hermet could you please re-run the CI? I think the previous one was failed due to some sort of time out. |
Hi all,
This commit resolves the first part of the feature request #3857 . Now users can bring their own allocator by using
meson setup builddir -Dcustom_allocator_header=/path/to/your_own_alloc.h
, and then provide the TVG_{MALLOC|CALLOC|REALLOC} macros.However I haven't got a chance to override the allocator for the 3rd party libraries like those JPG and PNG loaders. I will implement those later when I have some time.
Regards,
Jackson