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

Store release callback in parsec_object_t #731

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

devreal
Copy link
Contributor

@devreal devreal commented Feb 10, 2025

By default, objects created through PARSEC_OBJ_NEW will be free'd in the callback, objects constructed through PARSEC_OBJ_CONSTRUCT will only be destructed. Users/applications can provide their own release callback through
PARSEC_OBJ_RELEASE_CONSTRUCT.

Mempools break the PaRSEC object model. To store the mempool origin, a list item and an offset stored in the mempool that points to the mempool from where the item was allocated. We should consider adding a type parsec_mempool_item_t that stores the origin mempool. Then the release callback invoked from PARSEC_OBJ_RELEASE can put the object back into the mempool.

Yes, this adds 8B to the parsec_object_t but in today's world that is negligible and is outweighed by the benefits of having a more flexible object model.

Alternative to #726 and #728.

@devreal devreal requested a review from a team as a code owner February 10, 2025 13:28
By default, objects created through `PARSEC_OBJ_NEW`
will  be free'd in the callback, objects constructed through
`PARSEC_OBJ_CONSTRUCT` will only be destructed. Users/applications
can provide their own release callback through
`PARSEC_OBJ_RELEASE_CONSTRUCT`.

Mempools break the PaRSEC object model. To store the mempool origin,
a list item and an offset stored in the mempool that points to the
mempool from where the item was allocated. We should consider adding
a type `parsec_mempool_item_t` that stores the origin mempool.
Then the release callback invoked from `PARSEC_OBJ_RELEASE` can put the
object back into the mempool.

Yes, this adds 8B to the `parsec_object_t` but in today's world that is
negligible and is outweighed by the benefits of having a more flexible
object model.

Signed-off-by: Joseph Schuchart <[email protected]>
@devreal devreal force-pushed the parsec-object-release branch from 3c2baf2 to 24867d0 Compare February 13, 2025 00:32
@abouteiller abouteiller merged commit c7e719c into ICLDisco:master Feb 21, 2025
4 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