Access 2013 - 超出资源:MySql ODBC内存泄漏? [英] Access 2013 - Resources Exceeded: MySql ODBC Memory Leak?
问题描述
我有一个Access子程序,它会一直循环,直到满足条件。 在循环中,我正在访问单个链接的MySql表(通过ODBC),该表只有一行和三个小字段。 我使用DAO获取一个布尔字段的值,
,当该字段从false变为true时,循环退出。 一旦循环开始,我就可以看到Access消耗的RAM开始快速增加,并且随着执行的继续不断地执行此操作。 最终(约30分钟后)循环
因"资源超出"而崩溃。错误。
I have an Access subroutine that continuously loops until a condition is met. Within the loop, I am accessing a single linked MySql table (via ODBC) which has only one row and three small fields. I use DAO to obtain the value of one boolean field, and when that field changes from false to true, the loop exits. As soon as the loop starts, I can see that RAM consumed by Access starts to increase rapidly and continually does this as execution continues. Eventually (~30 minutes later) the loop crashes with a "resources exceeded" error.
如果我将链接表复制到Access数据库并从本机Access表运行循环,则内存保持不变。 因此,似乎通过MySQL ODBC驱动程序访问表导致问题。 为了释放资源,我关闭DAO
对象并将它们设置为"无"。
If I copy the linked table to my Access database and run the loop off the native Access table, memory stays constant. So, it appears that accessing the table via the MySQL ODBC driver is causing the issue. To free up resources, I close the DAO objects and set them to "nothing".
是否有人有建议如何解决此RAM /资源超出问题? 这是我的测试代码:
Does anyone have advice how to resolved this RAM/resources exceeded issue? Here is my test code:
推荐答案
我有一个Access子程序,它会一直循环,直到满足条件。  在循环中,我正在访问单个链接的MySql表(通过ODBC),该表只有一行和三个小字段。 我使用DAO获取一个布尔
字段的值,当该字段从false变为true时,循环退出。 一旦循环开始,我就可以看到Access消耗的RAM开始快速增加,并且随着执行的继续不断地执行此操作。 最终(约30分钟后)
循环因"超出资源"而崩溃。错误。
如果我将链接表复制到Access数据库并从本地Access表运行循环,则内存保持不变。 因此,似乎通过MySQL ODBC驱动程序访问表导致问题。 为了释放资源,我关闭DAO对象
并将它们设置为"nothing"。
有没有人有建议如何解决这个RAM /资源超出问题? 这是我的测试代码:
子测试()
 昏暗的dbsControls作为DAO.Database
  Dim rstControls As DAO.Recordset
  Dim boolStopLoop As Boolean
  boolStopLoop = False
 虽然不是boolStopLoop
  '获取控制参数
     设置dbsControls = CurrentDb
     设置rstControls = dbsControls.OpenRecordset(" control")
      rstControls.MoveFirst
      boolStopLoop = rstControls!boolStopLoop
      rstControls.Close
      dbsControls.Close
     设置rstControls = Nothing
     设置dbsControls = Nothing
  Wend $
End Sub
I have an Access subroutine that continuously loops until a condition is met. Within the loop, I am accessing a single linked MySql table (via ODBC) which has only one row and three small fields. I use DAO to obtain the value of one boolean field, and when that field changes from false to true, the loop exits. As soon as the loop starts, I can see that RAM consumed by Access starts to increase rapidly and continually does this as execution continues. Eventually (~30 minutes later) the loop crashes with a "resources exceeded" error.
If I copy the linked table to my Access database and run the loop off the native Access table, memory stays constant. So, it appears that accessing the table via the MySQL ODBC driver is causing the issue. To free up resources, I close the DAO objects and set them to "nothing".
Does anyone have advice how to resolved this RAM/resources exceeded issue? Here is my test code:
Sub Test()
Dim dbsControls As DAO.Database
Dim rstControls As DAO.Recordset
Dim boolStopLoop As Boolean
boolStopLoop = False
While Not boolStopLoop
' get control parameters
Set dbsControls = CurrentDb
Set rstControls = dbsControls.OpenRecordset("control")
rstControls.MoveFirst
boolStopLoop = rstControls!boolStopLoop
rstControls.Close
dbsControls.Close
Set rstControls = Nothing
Set dbsControls = Nothing
Wend
End Sub
这篇关于Access 2013 - 超出资源:MySql ODBC内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!