Canister status call result for nh4f6-niaaa-aaaai-abf2q-cai.
Status: Running
Controllers: jwlp2-oiaaa-aaaai-aaahq-cai
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 2_592_000
Memory Size: Nat(432881527)
Balance: 629_361_694_233 Cycles
Module hash: 0xa42d68a6d186aee112d9ef90a7745a6b2940360e848b7fe885725270fd1693ff
// test code
private stable var testEntries :[(Text, Text)] = [];
private var testMap = HashMap.fromIter<Text, Text>(testEntries.vals(), 0, Text.equal, Text.hash);
public func addMap(num : Nat): async(Nat){
var i : Nat = 0;
let oldsize = testMap.size();
i := oldsize;
var total = "hhhhhhhhhhhhh";
total := total # total;
while(i < num+oldsize) {
testMap.put(Nat.toText(i), total);
i+=1;
};
return testMap.size();
};
public func clear(num : Nat): async(Nat){
var i : Nat = 0;
while(i < num) {
label labelProcessLoop for( (k, v) in testMap.entries()){
testMap.delete(k);
break labelProcessLoop;
};
i+=1;
};
return testMap.size();
};
I use the function addmap to fill in the canister , and the memsize reaches 329mb. Then I call clear to delete the data, and the memsize reaches 432mb; After deleting the data in the testmap, why is the memsize still 432mb, as shown above