Skip to content

Commit

Permalink
Adjust test and refine documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-blaeser committed Jan 15, 2025
1 parent 1199225 commit c070645
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/md/canister-maintenance/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ actor {
}
```

A few aspects need to be considered with the low memory hook:
* The execution of `onLowMemory` happens with a certain delay, as it is scheduled as separate asynchronous message that runs after the message in which the threshold was crossed.
The following properties apply to the low memory hook:
* The execution of `onLowMemory` happens with a certain delay, as it is scheduled as a separate asynchronous message that runs after the message in which the threshold was crossed.
* Once executed, `onLowMemory` is only triggered again when the main memory free space went above the threshold (e.g. by lowering the threshold or shrinking the main memory through canister reinstallation) and when the free space again fell below the threshold.
* Traps or unhandled errors in `onLowMemory` are ignored. They only revert the changes done in `onLowMemory`.
* Due to its `async` return type, the `onLowMemory` function may send further messages and await results.
2 changes: 1 addition & 1 deletion test/bench/ok/region-mem.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: {heap_diff = 0; instr_diff = 5_234_491_753}
debug.print: {heap_diff = 0; instr_diff = 5_240_635_753}
ingress Completed: Reply: 0x4449444c0000
2 changes: 1 addition & 1 deletion test/bench/ok/region0-mem.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: {heap_diff = 0; instr_diff = 5_662_310_761}
debug.print: {heap_diff = 0; instr_diff = 5_668_454_761}
ingress Completed: Reply: 0x4449444c0000
2 changes: 1 addition & 1 deletion test/bench/ok/stable-mem.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: {heap_diff = 0; instr_diff = 3_875_537_257}
debug.print: {heap_diff = 0; instr_diff = 3_881_681_257}
ingress Completed: Reply: 0x4449444c0000
2 changes: 1 addition & 1 deletion test/fail/ok/M0129.tc.ok
Original file line number Diff line number Diff line change
@@ -1 +1 @@
M0129.mo:2.15-2.21: type error [M0129], unexpected system method named foobar, expected heartbeat or timer or preupgrade or postupgrade or inspect
M0129.mo:2.15-2.21: type error [M0129], unexpected system method named foobar, expected heartbeat or timer or preupgrade or postupgrade or onLowMemory or inspect

0 comments on commit c070645

Please sign in to comment.