[AccessD] Memory usage at import of MySQL tables (DoEvents Magic)

Gustav Brock Gustav at cactus.dk
Wed Jan 25 04:15:06 CST 2006


Hi all

Has anyone noticed how Access consumes memory if you importing data to a local table multiple times?
If you run the function below which empties and refills a local table with just 5000 records from a linked MySQL table, each run eats about 500K of memory. This is what the Task Manager shows.
That can quickly add up to a level where the app ceases to operate (flashing screen, loose of graphics, etc.). 

Public Function TestMem(ByVal lngRounds As Long)

  Dim dbs As DAO.Database
  Dim lngRound As Long
  
  Set dbs = CurrentDb
  
  With dbs
    For lngRound = 1 To lngRounds
      Debug.Print lngRound, Time
      .Execute "DeleteMessage"  ' empty local table.
      .Execute "AppendMessage"  ' append to local table.
    Next
  End With
  
  Set dbs = Nothing
  
End Function

However, if I call the function like this:

  DoEvents
  Result = TestMem(10)

the memory usage quickly stabilizes at some level.
Why that? DoEvents should do close to nothing _before_ you run the function ...

I haven't tried with import from other sources than MySQL.

/gustav




More information about the AccessD mailing list