[AccessD] Memory leak

Jim Lawrence accessd at shaw.ca
Fri Apr 14 14:20:02 CDT 2006


Hi John:

I would think that it would at the least and at the most consume all
available memory. 

The call to the ' FWInit CurrentProject.Connection ' should either be above
or below the 'While' loop.

A better was to the loop would be 
 
Function TestFWMemLeak()
    Dim BreakLoop as Boolean
	
    BreakLoop = True
	
    While BreakLoop = True
        DoEvents
        BreakLoop = FWInit CurrentProject.Connection
    Wend
End Function

Public Function FWInit(lCodeProjConn As ADODB.Connection) As Boolean

    ... 'etc....
    
    FWInit = False
	
End Function

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Colby
Sent: Thursday, April 13, 2006 7:14 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Memory leak

I have just discovered that the following code causes a memory leak:

Function TestFWMemLeak()
    While 1
        DoEvents
        FWInit CurrentProject.Connection
    Wend
End Function
Public Function FWInit(lCodeProjConn As ADODB.Connection)
End Function

Open task manager and keep it on top.  Find MSAccess and watch the memory
usage.  As you run TestFWMemLeak the memory usage climbs steadily.

When I google "memory leak ADODB.Connection" I get a ton of hits, though not
this specific issue.

John W. Colby
www.ColbyConsulting.com 


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list