Memory Management During Long Macro Execution

Hello,

I am trying to understand how OnlyOffice manages memory during a long macro execution process. I have a macro that is about 1400 lines long and it gets about 60% through the execution and then it throws up an error about being out of memory. Is there a way to clear the unused memory during the execution of the macro to prevent running into this scenario?

This workbook has 32 worksheets, so it is a large workbook.

Periodically throughout the macro, I am running this function so that the spreadsheet shows the values that are inputted into the cells, but am guessing that there is a better way to go about this.

    //Recalculate whole workbook again with all changes function
    function RecalculateWorkbook() {
        Api.asc_calculate(Asc.c_oAscCalculateType.All);
    }

Hello @qualm
Please clarify your PC hardware specifications.
As for the request itself, is it possible to provide the test file and the macro themselves, so we can take a closer look at them?