Does debug log add up to the Apex heap size? I had enabled debug logs with some specific debug filters in place and immediately hit the Apex heap size limit, when I turned it off the apex ran without hitting the limit. I couldn't find any documentation about debug logs contributing to the apex heap size. Has anyone experienced this?
No it should not, only variables you create in your Apex code contribute to it. In order to prove this, can you adjust the data volumes / records your code is consuming such that it does not hit the heap limit regardless. Then you can refer to the Debug Heap size summary at the bottom of the debug log. If it differs at all, I would say this is a bug and you need to raise a Salesfoce case.