Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possible Memory Leak

Status
Not open for further replies.

pd2004

Technical User
Aug 24, 2009
44
US
Hello,

I am concerned about the possibility that my application may be leaking memory. In the code below I added the line to set AppAccess = Nothing. Then I started to test. I open the task manager and check the memory used by Excel, then step through the program. After the program runs, the memory used gets larger and larger. Could anyone offer any suggestions. I would like to 1) stop any leaks, and 2) possibly empty memory via vba after Access is closed.

Thank you for all of your help,

Pat

Sub test2222()
accessrunner_no_string "C:\Documents and Settings\pd\My Documents\ZZZ_BIN", "Database61.mdb", "data_import_test"
End Sub

Sub accessrunner_no_string(pathname1 As String, dbsname1, modulename1)
'Application.Interactive = False
'Application.DisplayAlerts = False

'This is all access communication programming
Dim appAccess As Access.Application
Dim strDB As String
' Initialize string to database path.
strConPathToSamples = pathname1
strDB = strConPathToSamples & "\" & dbsname1
' Create new instance of Microsoft Access.

Set appAccess = _
CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB, True
appAccess.Visible = True
'end of access communication setup
appAccess.Run modulename1

appAccess.Quit

Set appAccess = Nothing



Application.Interactive = True
Application.DisplayAlerts = True


End Sub
 
Does the memory get larger every time you run through? I'm thinking that Excel may be keeping the connection info. I don't know if repeated processing would use the same connection or make new ones though. And I don't really know of a way to view a collection of connections?
Also I could be barking up the wrong tree.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top