Dynamic memory allocation which is also known as heap-based memory allocation is the allocation of memory storage for use in a computer program during the run time of that program. In Apex, the heap is the reference to the amount of memory used by your reachable objects for a given script and request.
The allocation of memory storage for use in a computer program during the run time of that program. When you create objects in your Apex code, memory is allocated to store these objects.
To know the recent Salesforce limit on heap size, check the below link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
Note:
The heap limit in Salesforce is calculated at run time and it also differs on how your Apex code is invoked.
Cheers!!!