Backported optimizations in memory allocations from TDR to master

Note that this branch sits on top of !858 (merged) and should thus not be merged before it

Merge request reports

Loading