Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Possible memory leak ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Emmanuel Gehin - 07 Feb 2005 10:53 GMT
When I use the following code in VB.NET :

Public Function test() As String
       Try
           Dim da1 As OdbcDataAdapter
           Dim i As Int32
           Dim tfem As DataTable
           For i = 0 To 1000
               da1 = New OdbcDataAdapter("select * from TABLE1 where
TABLE1.ID= '16'", "DSN=DSNTEST;UID=UIDTEST;PWD=PWDTEST;")
               tfem = New DataTable
               tfem.TableName = "TABLE1"
               da1.Fill(tfem)
               tfem.Dispose()
               tfem = Nothing
               da1.Dispose()
               da1 = Nothing
           Next
       Catch lerr As Exception
           Return lerr.Message
       End Try
       Return "Ok"
   End Function

or this one :

   Public Function test1() As String
       Try
           Dim da1 As OdbcDataAdapter
           Dim i As Int32
           Dim tfem As DataTable
           da1 = New OdbcDataAdapter("select * from TABLE1 where TABLE1.ID=
'16'", "DSN=DSNTEST;UID=UIDTEST;PWD=PWDTEST;")
           da1.SelectCommand.CommandTimeout = 0
           tfem = New DataTable
           tfem.TableName = "TABLE1"
           For i = 0 To 1000
               da1.Fill(tfem)
               tfem.Rows.Clear()
               tfem.Reset()
           Next
           tfem.Dispose()
           tfem = Nothing
           da1.Dispose()
           da1 = Nothing

       Catch lerr As Exception
           Return lerr.Message
       End Try
       Return "Ok"
   End Function

the memory used by my webservice never stop growing until the webservice
stop responding...The only solution is to kill aspnet_wp.exe to get back the
memory used.

Any suggestions ?
Dilip Krishnan - 07 Feb 2005 13:29 GMT
Hello Emmanuel,
   Thats not a memory leak. Thats just the dataset consuming memory :).
When the GC comes around to pick it up the memory should be freed.

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com

> When I use the following code in VB.NET :
>
[quoted text clipped - 51 lines]
>
> Any suggestions ?
M.Posseth - 07 Feb 2005 15:01 GMT
> Hello Emmanuel,
>    Thats not a memory leak. Thats just the dataset consuming memory :).
[quoted text clipped - 61 lines]
>>
>> Any suggestions ?

i can`t even inmagine how to make a memory leak with VB.net as the GC
should take care of it   ( then it would be a bug in the framework )
Dilip Krishnan - 08 Feb 2005 01:49 GMT
Hello M.Posseth,
   It is possible :) if you write code that makes you're object appear referenced
all the time.. sure the GC would never collect it and it will remain in memory
forever and ever :)

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com

>> Hello Emmanuel,
>> Thats not a memory leak. Thats just the dataset consuming memory :).
[quoted text clipped - 61 lines]
> i can`t even inmagine how to make a memory leak with VB.net as the GC
> should take care of it   ( then it would be a bug in the framework )

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.