Skip to content

Commit

Permalink
CHANGE: use memory pools for allocating handle context data when poss…
Browse files Browse the repository at this point in the history
…ible
  • Loading branch information
Oldes committed Oct 18, 2024
1 parent 213ae43 commit 93ff79c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/c-handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

//printf("Requested HOB for %s (%u) of size %u\n", SYMBOL_TO_NAME(sym), sym, size);
hob = (REBHOB*)Make_Node(HOB_POOL);
hob->data = Make_CMem(size);
hob->data = Make_Managed_CMem(1, size);
if (!hob->data) Trap0(RE_NO_MEMORY);
hob->index = idx;
hob->flags = HANDLE_CONTEXT;
Expand Down
4 changes: 3 additions & 1 deletion src/core/m-pools.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ FORCE_INLINE
}
}
}

FORCE_INLINE
/***********************************************************************
**
*/ void Free_Managed_CMem(void *address)
Expand Down Expand Up @@ -758,7 +760,7 @@ FORCE_INLINE
}

CLEAR(hob->data, spec.size);
Free_Mem(hob->data, spec.size);
Free_Managed_CMem(hob->data);
UNUSE_HOB(hob);
Free_Node(HOB_POOL, (REBNOD *)hob);
return 1;
Expand Down

0 comments on commit 93ff79c

Please sign in to comment.