OLEDB, sql server, and memory leak




I am running a managed application (ASP.NET)... it is leaking
unmanaged memory.

Using the debug diagnostic tool 1.1, the dump analysis report shows
that:


msdatl3.dll (a known Windows memory manager) is responsible for 828.81
MBytes worth of outstanding allocations. These allocations
appear to have originated from the following module(s) and
function(s):

sqloledb!CDBConnection::GetColData+2c8


The code involved in this leak is performing a SELECT and then reads
the data. One db field of concern is typed nvarchar(MAX).

The code basically looks like this:

Dim x,y,x as String

Dim reader As OleDbDataReader

Dim sqlstr As String = "SELECT * FROM pages WHERE pID = some page id
Dim cmd As New OleDbCommand(sqlstr, db.getconnection())
reader = cmd.ExecuteReader

reader.Read()
If reader.HasRows() Then
x = reader("col1")
y = reader("col2")
z = reader("col3") ' where col3 is of type nvarchar(MAX)
End If

reader.Close()

The size of col3, nvarchar(MAX), varies between 2,000 and 80,000
bytes.


Question: what am I doing wrong? Am I failing to clean up in some
way (I thought all I had to do was close the reader). Is there a
different/better way to read the nvarchar(MAX) field?


thanks.

.



Relevant Pages

  • Help with streamwriter
    ... I have created a filesystem where a manager ... Dim oRead As New System.IO.StreamReader' Should ... Dim arr As String ... Private Sub btnLastRecord_Click(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • RE: How do I print documents from a folder within a certain date range
    ... modified and converts these dates and the dates entered by the manager to ... Dim oFSO As Scripting.FileSystemObject ... Dim Extension As String ... MsgBox "Invalid start date", vbExclamation, AppTitle ...
    (microsoft.public.word.docmanagement)
  • Re: Server.URLEncode :-(
    ... You can also avoid it by parameterizing your dynamic sql statement and using ... > <%Dim RS ... > Loop %> ... > you click on the manager you go to page 2 and get a breakdown of the ...
    (microsoft.public.inetserver.asp.general)
  • Re: USB ports not working for camera or card reader
    ... Does the Cad Reader appear now? ... > I'm actually on my 3rd digital camera. ... > manager says all is working correctly. ... > download pictures. ...
    (microsoft.public.windowsxp.hardware)
  • Send and Address an email using a Query Data
    ... I have a query that returns the employees that will be attending ... I want to loop through the query pulling the manager and all their ... Dim objOutlook As Outlook.Application ... Dim objOutlookMsg As Outlook.MailItem ...
    (microsoft.public.access.modulesdaovba)