mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-03 19:26:34 +02:00
Added gc_heap_type and HEAP_HUGE
This commit is contained in:
parent
ef25448c63
commit
54f217fd4b
2 changed files with 12 additions and 2 deletions
1
gc.c
1
gc.c
|
@ -184,6 +184,7 @@ gc_heap *gc_heap_create(int heap_type, size_t size, size_t max_size,
|
|||
h = malloc(padded_size); // TODO: mmap?
|
||||
if (!h)
|
||||
return NULL;
|
||||
h->type = heap_type;
|
||||
h->size = size;
|
||||
//h->free_size = size;
|
||||
cached_heap_total_sizes[heap_type] += size;
|
||||
|
|
|
@ -142,8 +142,16 @@ struct gc_thread_data_t {
|
|||
|
||||
/* GC data structures */
|
||||
|
||||
typedef enum { HEAP_SM = 0, HEAP_MED, HEAP_REST
|
||||
} cached_heap_type;
|
||||
/**
|
||||
* Group heap pages by type, to attempt to limit fragmentation
|
||||
* and improve performance.
|
||||
*/
|
||||
typedef enum {
|
||||
HEAP_SM = 0 // 32 byte objects (min gc_heap_align)
|
||||
, HEAP_MED // 64 byte objects (twice the min)
|
||||
, HEAP_HUGE // Huge objects, 1 per page
|
||||
, HEAP_REST // Everything else
|
||||
} gc_heap_type;
|
||||
|
||||
typedef struct gc_free_list_t gc_free_list;
|
||||
struct gc_free_list_t {
|
||||
|
@ -153,6 +161,7 @@ struct gc_free_list_t {
|
|||
|
||||
typedef struct gc_heap_t gc_heap;
|
||||
struct gc_heap_t {
|
||||
gc_heap_type type;
|
||||
unsigned int size;
|
||||
unsigned int chunk_size; // 0 for any size, other and heap will only alloc chunks of that size
|
||||
unsigned int max_size;
|
||||
|
|
Loading…
Add table
Reference in a new issue