i tried to shrink the region page to 0 but it’s still the same as before.
or this is impossible for now? if so, then i should overwrite the region starting from position 0, yes?
i tried to shrink the region page to 0 but it’s still the same as before.
or this is impossible for now? if so, then i should overwrite the region starting from position 0, yes?
Can you remove all references to the Region so that it gets garbage collected?
No, you cannot shrink a region, just as you cannot shrink raw stable memory.
Unfortunately, garbage collection of regions, though planned for, is not yet implemented.
https://internetcomputer.org/blog/2023/09/13/news-and-updates/update#moc-0100—motoko-stable-regions
A Region
is a new Motoko abstract data type that uses an API which exposes low-level canister stable memory. Region
s are unique since they use distinct portions of stable memory that never interfere with one another. New Region
s can be created dynamically, and any old regions that are marked for garbage collection will be removed and reused for new Region
s afterwards.
The bit in italics is inaccurate. I’m not sure how that got out but it is a misunderstanding.