mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
merge from dev
This commit is contained in:
commit
a7a0db06d5
3 changed files with 8 additions and 6 deletions
|
@ -307,8 +307,8 @@ mi_decl_export bool mi_abandoned_visit_blocks(mi_subproc_id_t subproc_id, int he
|
||||||
mi_decl_export void mi_heap_guarded_set_sample_rate(mi_heap_t* heap, size_t sample_rate, size_t seed);
|
mi_decl_export void mi_heap_guarded_set_sample_rate(mi_heap_t* heap, size_t sample_rate, size_t seed);
|
||||||
mi_decl_export void mi_heap_guarded_set_size_bound(mi_heap_t* heap, size_t min, size_t max);
|
mi_decl_export void mi_heap_guarded_set_size_bound(mi_heap_t* heap, size_t min, size_t max);
|
||||||
|
|
||||||
// Experimental: communicate that the thread associated with the heap runs in a threadpool
|
// Experimental: communicate that the thread is part of a threadpool
|
||||||
mi_decl_export void mi_heap_set_in_threadpool(void) mi_attr_noexcept;
|
mi_decl_export void mi_thread_set_in_threadpool(void) mi_attr_noexcept;
|
||||||
|
|
||||||
// Experimental: create a new heap with a specified heap tag. Set `allow_destroy` to false to allow the thread
|
// Experimental: create a new heap with a specified heap tag. Set `allow_destroy` to false to allow the thread
|
||||||
// to reclaim abandoned memory (with a compatible heap_tag and arena_id) but in that case `mi_heap_destroy` will
|
// to reclaim abandoned memory (with a compatible heap_tag and arena_id) but in that case `mi_heap_destroy` will
|
||||||
|
|
|
@ -166,10 +166,6 @@ mi_heap_t* mi_heap_get_backing(void) {
|
||||||
return bheap;
|
return bheap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mi_heap_set_in_threadpool(void) mi_attr_noexcept {
|
|
||||||
// nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: make order of parameters consistent (but would that break compat with CPython?)
|
// todo: make order of parameters consistent (but would that break compat with CPython?)
|
||||||
void _mi_heap_init(mi_heap_t* heap, mi_arena_id_t arena_id, bool allow_destroy, uint8_t heap_tag, mi_tld_t* tld)
|
void _mi_heap_init(mi_heap_t* heap, mi_arena_id_t arena_id, bool allow_destroy, uint8_t heap_tag, mi_tld_t* tld)
|
||||||
{
|
{
|
||||||
|
|
|
@ -602,6 +602,12 @@ void _mi_heap_set_default_direct(mi_heap_t* heap) {
|
||||||
_mi_prim_thread_associate_default_heap(heap);
|
_mi_prim_thread_associate_default_heap(heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mi_thread_set_in_threadpool(void) mi_attr_noexcept {
|
||||||
|
mi_tld_t* tld = mi_tld();
|
||||||
|
if (tld!=NULL) {
|
||||||
|
tld->is_in_threadpool = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// Run functions on process init/done, and thread init/done
|
// Run functions on process init/done, and thread init/done
|
||||||
|
|
Loading…
Add table
Reference in a new issue