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: #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.