Skip to content

Add per-instance custom memory allocator interface - #235

Merged
kpchoi merged 3 commits into
mainfrom
add_memory_interface_functions
Aug 6, 2026
Merged

Add per-instance custom memory allocator interface#235
kpchoi merged 3 commits into
mainfrom
add_memory_interface_functions

Conversation

@kpchoi

@kpchoi kpchoi commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

This adds a way for applications to supply their own memory allocator, as discussed in #228.

  • New oapv_ops_mem_t interface (malloc/calloc/realloc/free plus an opaque udata), passed through the creation descriptors: oapve_cdesc_t, oapvd_cdesc_t, and a new oapvm_cdesc_t for the metadata container
  • All internal allocations are routed through the instance allocator — encoder, decoder, metadata container, and thread pool. No raw malloc/free calls remain in the library
  • Leaving ops_mem as NULL keeps the standard C library behavior; there is no global allocator state
  • Note: oapvm_create() now takes a descriptor argument, so metadata container callers need a small update

Usage is documented in the "Custom memory allocator" section of the README.

kpchoi added 3 commits August 6, 2026 13:02
Encoder/decoder route all internal allocations through a caller-supplied
oapv_ops_mem_t (via cdesc.ops_mem), defaulting to the standard C library.

Signed-off-by: KP Choi <kp5.choi@samsung.com>
Signed-off-by: KP Choi <kp5.choi@samsung.com>
Signed-off-by: KP Choi <kp5.choi@samsung.com>
@kpchoi
kpchoi requested a review from mss-park August 6, 2026 05:17

@mss-park mss-park left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me.

@kpchoi
kpchoi merged commit 83937c6 into main Aug 6, 2026
12 of 13 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.

2 participants