mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
initial delay slots
This commit is contained in:
parent
3d0a1e249f
commit
829fd872f4
9 changed files with 171 additions and 50 deletions
|
@ -385,6 +385,19 @@ void _mi_stat_counter_increase(mi_stat_counter_t* stat, size_t amount);
|
|||
#define mi_heap_stat_decrease(heap,stat,amount) mi_stat_decrease( (heap)->tld->stats.stat, amount)
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Delay slots (to avoid expensive OS calls)
|
||||
// ------------------------------------------------------
|
||||
typedef int64_t mi_msecs_t;
|
||||
|
||||
typedef struct mi_delay_slot_s {
|
||||
mi_msecs_t expire;
|
||||
uint8_t* addr;
|
||||
size_t size;
|
||||
} mi_delay_slot_t;
|
||||
|
||||
#define MI_RESET_DELAY_SLOTS (128)
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Thread Local data
|
||||
// ------------------------------------------------------
|
||||
|
@ -395,6 +408,12 @@ typedef struct mi_segment_queue_s {
|
|||
mi_segment_t* last;
|
||||
} mi_segment_queue_t;
|
||||
|
||||
// OS thread local data
|
||||
typedef struct mi_os_tld_s {
|
||||
size_t region_idx; // start point for next allocation
|
||||
mi_stats_t* stats; // points to tld stats
|
||||
mi_delay_slot_t reset_delay[MI_RESET_DELAY_SLOTS];
|
||||
} mi_os_tld_t;
|
||||
|
||||
// Segments thread local data
|
||||
typedef struct mi_segments_tld_s {
|
||||
|
@ -408,14 +427,9 @@ typedef struct mi_segments_tld_s {
|
|||
size_t cache_size; // total size of all segments in the cache
|
||||
mi_segment_t* cache; // (small) cache of segments
|
||||
mi_stats_t* stats; // points to tld stats
|
||||
mi_os_tld_t* os; // points to os stats
|
||||
} mi_segments_tld_t;
|
||||
|
||||
// OS thread local data
|
||||
typedef struct mi_os_tld_s {
|
||||
size_t region_idx; // start point for next allocation
|
||||
mi_stats_t* stats; // points to tld stats
|
||||
} mi_os_tld_t;
|
||||
|
||||
// Thread local data
|
||||
struct mi_tld_s {
|
||||
unsigned long long heartbeat; // monotonic heartbeat count
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue