473,785 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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;UI D=UIDTEST;PWD=P WDTEST;")
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;UI D=UIDTEST;PWD=P WDTEST;")
da1.SelectComma nd.CommandTimeo ut = 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...Th e only solution is to kill aspnet_wp.exe to get back the
memory used.

Any suggestions ?
Nov 23 '05 #1
3 4477
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;UI D=UIDTEST;PWD=P WDTEST;")
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;UI D=UIDTEST;PWD=P WDTEST;")
da1.SelectComma nd.CommandTimeo ut = 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...Th e 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;UI D=UIDTEST;PWD=P WDTEST;")
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;UI D=UIDTEST;PWD=P WDTEST;")
da1.SelectComma nd.CommandTimeo ut = 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...Th e 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;UI D=UIDTEST;PWD=P WDTEST;")
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;UI D=UIDTEST;PWD=P WDTEST;")
da1.SelectComma nd.CommandTimeo ut = 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...Th e 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
1979
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; int port; char *path;
8
3414
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 ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
17
4815
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 easier to reproduce (e.g.: remote machine not available). After about 1 day, I get a usage of 300MB of memory. I have used .NET Memory Profiler tool to try to see where the leak is located. For all the leaky instances, I can see the following (I...
4
6093
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"; scope.Path.Path=@"\\pc\root\cimv2";
20
8119
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 matches are called within a loop (like if or for). E.g. for(int i = 0; i < 10; i++) { Regex r = new Regex();
3
5327
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". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
1
2271
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 made, the garbage collector cannot clean it up. First of all, it seems that it's best to avoid using __del__. So far, I have never used it in my Python programming. So I am safe there. Or am I? Also, to my knowledge, I have never created a...
7
15716
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 lot of memory but I still had to use it. 1. After using DLLImport and seeing the memory leak I tried to load and
22
9365
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 memory leak someplace. I can not detect the memory leak by running several reports by hand, but when I run tha app as a servrice and process few hundred reports there is significant memory leak. The application can consume over 1GB of memory where it...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10319
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.