more efficient stack memory management