34
34
* blocks so we can free them at cleanup time.
36
36
/* Raw memory procedures */
37
private gs_memory_proc_alloc_bytes(gs_heap_alloc_bytes);
38
private gs_memory_proc_resize_object(gs_heap_resize_object);
39
private gs_memory_proc_free_object(gs_heap_free_object);
40
private gs_memory_proc_stable(gs_heap_stable);
41
private gs_memory_proc_status(gs_heap_status);
42
private gs_memory_proc_free_all(gs_heap_free_all);
37
static gs_memory_proc_alloc_bytes(gs_heap_alloc_bytes);
38
static gs_memory_proc_resize_object(gs_heap_resize_object);
39
static gs_memory_proc_free_object(gs_heap_free_object);
40
static gs_memory_proc_stable(gs_heap_stable);
41
static gs_memory_proc_status(gs_heap_status);
42
static gs_memory_proc_free_all(gs_heap_free_all);
44
44
/* Object memory procedures */
45
private gs_memory_proc_alloc_struct(gs_heap_alloc_struct);
46
private gs_memory_proc_alloc_byte_array(gs_heap_alloc_byte_array);
47
private gs_memory_proc_alloc_struct_array(gs_heap_alloc_struct_array);
48
private gs_memory_proc_object_size(gs_heap_object_size);
49
private gs_memory_proc_object_type(gs_heap_object_type);
50
private gs_memory_proc_alloc_string(gs_heap_alloc_string);
51
private gs_memory_proc_resize_string(gs_heap_resize_string);
52
private gs_memory_proc_free_string(gs_heap_free_string);
53
private gs_memory_proc_register_root(gs_heap_register_root);
54
private gs_memory_proc_unregister_root(gs_heap_unregister_root);
55
private gs_memory_proc_enable_free(gs_heap_enable_free);
56
private const gs_memory_procs_t gs_malloc_memory_procs =
45
static gs_memory_proc_alloc_struct(gs_heap_alloc_struct);
46
static gs_memory_proc_alloc_byte_array(gs_heap_alloc_byte_array);
47
static gs_memory_proc_alloc_struct_array(gs_heap_alloc_struct_array);
48
static gs_memory_proc_object_size(gs_heap_object_size);
49
static gs_memory_proc_object_type(gs_heap_object_type);
50
static gs_memory_proc_alloc_string(gs_heap_alloc_string);
51
static gs_memory_proc_resize_string(gs_heap_resize_string);
52
static gs_memory_proc_free_string(gs_heap_free_string);
53
static gs_memory_proc_register_root(gs_heap_register_root);
54
static gs_memory_proc_unregister_root(gs_heap_unregister_root);
55
static gs_memory_proc_enable_free(gs_heap_enable_free);
56
static const gs_memory_procs_t gs_malloc_memory_procs =
58
58
/* Raw memory procedures */
59
59
gs_heap_alloc_bytes,
229
229
return gs_heap_alloc_bytes(mem, (uint) lsize, cname);
232
232
gs_heap_alloc_struct_array(gs_memory_t * mem, uint num_elements,
233
233
gs_memory_type_ptr_t pstype, client_name_t cname)
273
273
gs_alloc_fill_alloc, new_size - old_size);
274
274
return new_ptr + 1;
277
277
gs_heap_object_size(gs_memory_t * mem, const void *ptr)
279
279
return ((const gs_malloc_block_t *)ptr)[-1].size;
281
private gs_memory_type_ptr_t
281
static gs_memory_type_ptr_t
282
282
gs_heap_object_type(const gs_memory_t * mem, const void *ptr)
284
284
return ((const gs_malloc_block_t *)ptr)[-1].type;
287
287
gs_heap_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
289
289
gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;
342
342
free((char *)((gs_malloc_block_t *) ptr - 1));
346
346
gs_heap_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
348
348
return gs_heap_alloc_bytes(mem, nbytes, cname);
351
351
gs_heap_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
352
352
client_name_t cname)
356
356
client_name_string(cname), (ulong) data);
357
357
return gs_heap_resize_object(mem, data, new_num, cname);
360
360
gs_heap_free_string(gs_memory_t * mem, byte * data, uint nbytes,
361
361
client_name_t cname)
363
363
/****** SHOULD CHECK SIZE IF DEBUGGING ******/
364
364
gs_heap_free_object(mem, data, cname);
367
367
gs_heap_register_root(gs_memory_t * mem, gs_gc_root_t * rp,
368
368
gs_ptr_type_t ptype, void **up, client_name_t cname)
373
373
gs_heap_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp,
374
374
client_name_t cname)
377
private gs_memory_t *
378
378
gs_heap_stable(gs_memory_t *mem)
380
380
return mem; /* heap memory is stable */
383
383
gs_heap_status(gs_memory_t * mem, gs_memory_status_t * pstat)
385
385
gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;