Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit f508992

Browse files
committed
Switch from malloc to the fixed size allocator for object bodies.
1 parent 1401ec6 commit f508992

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/metamodel/reprs/P6opaque.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ static PMC * instance_of(PARROT_INTERP, PMC *self, PMC *WHAT) {
355355
compute_allocation_strategy(interp, WHAT, repr);
356356

357357
/* Allocate and set up object instance. */
358-
obj = mem_sys_allocate_zeroed(repr->allocation_size);
358+
obj = Parrot_gc_allocate_fixed_size_storage(interp, repr->allocation_size);
359+
memset(obj, 0, repr->allocation_size);
359360
obj->common.stable = STABLE_PMC(WHAT);
360361

361362
/* The spill slot gets set to PMCNULL; it not being (C) NULL is what
@@ -525,7 +526,8 @@ static void gc_mark(PARROT_INTERP, PMC *self, PMC *obj) {
525526

526527
/* This Parrot-specific addition to the API is used to free an object. */
527528
static void gc_free(PARROT_INTERP, PMC *self, PMC *obj) {
528-
mem_sys_free(PMC_data(obj));
529+
REPRP6opaque *repr = P6O_REPR_STRUCT(self);
530+
Parrot_gc_free_fixed_size_storage(interp, repr->allocation_size, PMC_data(obj));
529531
PMC_data(obj) = NULL;
530532
}
531533

0 commit comments

Comments
 (0)