If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > ado memory leak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-02-03, 15:09
bongi bongi is offline
Registered User
 
Join Date: Sep 2003
Posts: 1
ado memory leak

Hello
Environment:Windows xp home, mdac 2.8 ,Vb 6.0, Db2 Version 7 fix pack 1
i suffer a memory leak when running the following pgm:
every time i display an article using the 'V' selection i see the memory
usead by the pgm increased by 4kb to 12 kb.
i first suspected the mdac component,so i installed the 2.8 version
but the problem is still present.
Anyone can help me ?
this is the involved code :

the connection parameters:

Dim Cn As New adodb.Connection
Dim rs As New adodb.Recordset
Dim cmd As New adodb.Command
Dim ErrSql As adodb.Error
Public Const DB2 = "Provider=IBMDADB2.1;Data Source=DBstore;Persist Security

Info=False"
Public Connect As String
Connect = DB2
Cn.Mode = adModeRead
Cn.CursorLocation = adUseServer
Cn.ConnectionTimeout = 5
Cn.Open (Connect)
Set cmd.ActiveConnection = Cn
rs.LockType = adLockReadOnly
rs.MaxRecords = 0
rs.CacheSize = 1
rs.CursorType = adOpenForwardOnly

the code:
.......
Case "V"
txtArticolo.SetFocus
cmd.CommandText = "SELECT * FROM Prodotti WHERE articolo = " & Articolo
Set rs = cmd.Execute(, , adCmdText)
Call Associa
Call Formatta
Call Dissocia
Call Chiudi
TxtSelezione.SetFocus
If txtArticolo.Text = Empty Then
Call Dissocia
txtArticolo.Text = Articolo
MsgBox Inesistente
End If
..............

Public Sub Associa()
Set txtArticolo.DataSource = rs
Set txtDescrizione.DataSource = rs
Set MskDate.DataSource = rs
Set txtPrezzo.DataSource = rs
Set txtGiacenza.DataSource = rs
Set txtScorta.DataSource = rs
Set txtLotto.DataSource = rs
AssociaOk = True
End Sub
Public Sub Dissocia()
Set txtArticolo.DataSource = Nothing
Set txtDescrizione.DataSource = Nothing
Set MskDate.DataSource = Nothing
Set txtPrezzo.DataSource = Nothing
Set txtGiacenza.DataSource = Nothing
Set txtScorta.DataSource = Nothing
Set txtLotto.DataSource = Nothing
AssociaOk = False
End Sub

Public Sub Chiudi()
rs.Close
Set rs = Nothing
End Sub
__________________________________________________ __
thank in advance
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On