I was wondering if it is possible to add system API to zeroize 64-bit stable memory?
I’m working on stable collections in
ic-stable-memory and for now some of these collections are limited in size because of that. For example a
SHashMap requires you to zeroize the whole block of memory, before using it and right now I’m doing it by creating a cleaning vector
vec![0u8; SIZE] and writing it into the desired position in stable memory which is both: expensive and limited (since I can’t create a
Vec bigger than 4GBs). So the maximum size of a
SHashMap is also limited to 4GBs.
There is a workaround - you can write this cleaning vector multiple times to different locations, but I’m afraid this would simply make a canister hit message limit. I believe there should be a lower level (and much cheaper) API to physically discharge bits to zeros that can be exposed through IC’s API, but maybe I’m wrong.