Excel file uses accumulating memory
I have an excel file that is only 1MB but grows memory usage indefinitely
(above 6GB) as it runs until it crashes.
The sheet is composed of 100 independent rows with about 300 columns each
where it pulls in data from an Add-in and does excel calculations. The
excel has VBA that connects to a local Access DB to pull 10,000 ID's,
which then goes through them in groups of 100 at a time, pulls in data
from the add-in (using UDF's) and then goes to the next 100.
It does the following steps: 1) Pull in a list of 10,000 unique
8-character IDs from an Access DB, inserts them into Sheet2 (unused for
anything else) - this part doesn't use much memory 2) In VBA - starting at
the top, it loops through in blocks of 100 ID's at a time, copies them
into A1:A100 positions in Sheet1 with the 300 columns of referencing UDF's
and calculations to the ID in columb A for each row 3) Calculates the
sheet to pull in new data from the UDF's for each column
This seems to only add to memory usage each time it is run even though the
previous block of 100 ID's is gone (I did it this way since it seemed to
crash if I did 10,000 all at once). The workbook is on MANUAL calculation
(hence step 3); and all objects are being set to = Nothing once done for
the DB information copying.
How do I stop the memory usage from accumulating? It seems related to the
UDF's not clearing out of memory once they have been run. Is there a way
to clear any cache in Excel or reset it with VBA after each block of 100
IDs? Thanks
No comments:
Post a Comment