Should allocate_cell() return a cell with a ref count of one/ #2

Closed
opened 2026-02-05 00:04:47 +00:00 by simon · 3 comments
Owner

Everything that allocates a cell subsequently has to inc_ref it. It would save a lot of code if the initial inc_ref was done in allocate_cell().

But it would also mean I'd need to undo a lot of pernickety code which already more or less works.

Everything that allocates a cell subsequently has to inc_ref it. It would save a lot of code if the initial inc_ref was done in allocate_cell(). But it would also mean I'd need to undo a lot of pernickety code which already more or less works.
Author
Owner

OK, we're doing this. cons_page/allocate_cell(tag) shall always return a cell with count = 1. It shall be the responsibility of the creating function to ensure that that cell gets appropriately dereferenced when it goes out of scope.

This is going to be a big, uncomfortable change.

Feature branch is feature-2

OK, we're doing this. `cons_page/allocate_cell(tag)` shall *always* return a cell with count = 1. It shall be the responsibility of the creating function to ensure that that cell gets appropriately dereferenced when it goes out of scope. This is going to be a big, uncomfortable change. Feature branch is `feature-2`
Author
Owner

OK, first commit on the feature branch. Not currently deallocating anything :-(

OK, first commit on the feature branch. Not currently deallocating anything :-(
Author
Owner

This is essentially fixed in commit 219f082. This commit reduces the amount of memory being allocated by an order of magnitude, which is good, but it doesn't do nearly enough to increase the number being reclaimed.

This is essentially fixed in commit 219f082. This commit reduces the amount of memory being allocated by an order of magnitude, which is good, but it doesn't do nearly enough to increase the number being reclaimed.
simon closed this issue 2026-02-14 20:53:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: simon/post-scarcity#2
No description provided.