-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Lines 319 to 337 in 24c26bb
| static struct heapArena * | |
| gcContains(struct GC *gc, void *p) { | |
| struct heapArena *h = gc->heap; | |
| while (h != NULL) { | |
| if (heapArenaContains(h, p)) { | |
| return h; | |
| } | |
| h = h->next; | |
| } | |
| h = gc->large; | |
| while (h != NULL) { | |
| if (heapArenaContains(h, p)) { | |
| return h; | |
| } | |
| h = h->next; | |
| } | |
| return NULL; | |
| } |
Currently the gcContains function is a O(n) operation, if the each heap arean is 64M, and the process memory usage is 8G
Then there will be 128 heap arenas ... it still cost too much.
We can organize the heap arenas as ordered or as tree struct, to reduce the cost to O(logN)
Metadata
Metadata
Assignees
Labels
No labels