81 |
It would be cleaner to have a separate function sweep_value(), but |
It would be cleaner to have a separate function sweep_value(), but |
82 |
that is too slow (functions with switch statements can't be |
that is too slow (functions with switch statements can't be |
83 |
inlined). |
inlined). |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
*/ |
NOTE: |
89 |
|
|
90 |
|
This function is quite efficient. However, for many types of cells, |
91 |
|
allocation and a de-allocation involves calling malloc() and |
92 |
|
free(). |
93 |
|
|
94 |
|
This is costly for small objects (due to malloc/free overhead.) |
95 |
|
(should measure this). |
96 |
|
|
97 |
|
It might also be bad for threads: if several threads are allocating |
98 |
|
strings concurrently, then mallocs for both threads may have to |
99 |
|
fiddle with locks. |
100 |
|
|
101 |
|
It might be interesting to add a separate memory pool for small |
102 |
|
objects to each freelist. |
103 |
|
|
104 |
|
--hwn. |
105 |
|
*/ |
106 |
int |
int |
107 |
scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg) |
scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg) |
108 |
#define FUNC_NAME "sweep_card" |
#define FUNC_NAME "sweep_card" |