Feature request: on demand heap allocation
I'm storing configuration in SPIFFS and so I have to size the DynamicJsonDocument
large enough that it won't unexpectedly fail to read/write the whole configuration file.
The problem I have is that this allocation is then always quite large and made in one request from the heap, which significantly fragments the heap. I'd like it to make additional allocations as required from the heap up to a specified limit instead. I don't need it to free the memory until the document is destroyed.
I know you've discounted this on the basis that it causes more heap fragmentation but I disagree. The fragmentation of the heap is affected by the size of allocations being made. By always making one big allocation (5% of total memory) there's a significant risk that once freed the space occupied by that allocation will be reused by smaller allocations and a contiguous block of that size will no longer be available from the heap.