paritytech / parity-scale-codec

Lightweight, efficient, binary serialization and deserialization codec
Apache License 2.0
243 stars 95 forks source link

Limit `decode()` heap memory usage #609

Open serban300 opened 1 month ago

serban300 commented 1 month ago

We would like to be able to specify a rough limit for the heap memory usage while decoding a structure.

We have this draft PR as a starting point: https://github.com/paritytech/parity-scale-codec/pull/602 . The problem with this approach is that it is intentionally not type safe, for backwards compatibility. We would like to make it type-safe and release it as part of v4.