tags:

views:

461

answers:

2

I have a vba macro which runs a loop for about 200 iterations, using up the ram page file as it runs. I need some kind of quick fix to clear the page file after every iteration. I know the best fix would be to clean up the code, but time is a constraint here.

+2  A: 

At the end of each loop iteration set any objects that will be re-created to Nothing.

This article explains it in detail.

Mitch Wheat
The Nothing tip is useful, but this function has too many cyclical references. Need to clean up the code.
A: 

I've never seen this happen. It sounds like you have an ever-expanding array and may be running out of memory. I would stop it in a few places during the run, to see what is happening.

dbb
It is an array, but is cleared to nothing after each iteraration. The memory however, is not freed up.