Preupgrade and postupgrade limits

Are there cycle limits on preupgrade and postupgrade? I would imagine that large hashmaps, lists, etc being output to an array will take some significant cycles once they get pretty large. Likewise, loading a few hundred thousand items out of an array into a HashMap will take some time as well.

1 Like

The cycles limits are enforced at the message level not at the pre/post upgrade canister method level. You can find the definition here:

If you have inefficient serialization/deserialization of your stable memory data in those pre/post hooks, you can hit the execution message limit. If you hit this limit, your state will not be committed (it’ll roll back) but the cycles that’ve been consumed will be deducted from your canister’s cycle balance.



Do you know where we can find that execution limit?

You can find some of the execution limits in the file I linked above, there are subnet type specific limits defined in there.