473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Possible memory leak ?

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 ?
Nov 23 '05 #1
3 4459
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 :

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 ?


Nov 23 '05 #2
Dilip Krishnan wrote:
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 :

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 ?


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 )

Nov 23 '05 #3
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
Dilip Krishnan wrote:
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 :

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 ?

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 )


Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Roman Mashak | last post by:
Hello, All! I have this small piece of code, where segmentation fault happenes only upon runnin code. No problems during debug (JFI I'm using gdb-6.3): ---- struct host_info { char *host;...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
1
by: Joe Peterson | last post by:
I've been doing a lot of searching on the topic of one of Python's more disturbing issues (at least to me): the fact that if a __del__ finalizer is defined and a cyclic (circular) reference is...
7
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.