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

Initial heap local deferred free implementation #397

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

playXE
Copy link

@playXE playXE commented Apr 29, 2021

@daanx I actually managed to implement heap local deferred free function in a few minutes. But I don't know if my code that invokes heap->deferred_free function in _mi_deferred_free is correct.

doc/mimalloc-doc.h Outdated Show resolved Hide resolved
src/page.c Show resolved Hide resolved
@playXE playXE marked this pull request as ready for review May 2, 2021 11:35
@playXE
Copy link
Author

playXE commented May 10, 2021

@daanx, @jserv any updates? :)

/// @param arg Argument that was passed at registration to hold extra state.
///
/// @see mi_heap_register_deferred_free
typedef void (mi_local_deferred_free_fun)(mi_heap_t* heap,bool force,unsigned long long heartbeat,void* arg);
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistent style, a space character should follow the comma. That is,

typedef void (mi_local_deferred_free_fun)(mi_heap_t* heap, bool force, unsigned long long heartbeat, void* arg);

/// to be called deterministically after some number of allocations
/// (regardless of freeing or available free memory).
/// At most one \a deferred_free function can be active.
void mi_heap_register_deferred_free(mi_heap_t* heap,mi_local_deferred_free_fun* deferred_free, void* arg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto. Take care of the style.

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