473,382 Members | 1,445 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,382 software developers and data experts.

Memory leaks?

Hi, I have an app which connects to an Access database on a server, there
are around 10 clients. It's a fairly heavy data intensive app, but most of
the traffic is look up data.

While the system appears to run completely error free around every 6 weeks
the server stops serving the network share where the database resides. When
a client tried to connect you get an error message something like Not enough
resources or disk failure. Resetting the server cleares the problem. More
worrying is a large database corruption that happened just a couple of days
ago.

As far as I can tell my code is correct and I'm not leaving anything open or
connected that shouldn't be. Is there any way to trace or track what
connections and/or resources are being used by each Client? Or if my code
is generating any memory leaks?

Cheers,
Tull.
Oct 12 '06 #1
4 1403
Check to see if your Access db is being opened repeatedly and never
closed, or if a large number of file locks are accumulating on it. For
a Windows server, you can check here:

Control Panel/Administrative Tools/Computer Management/Shared
Folders/Open Files

Oct 12 '06 #2
This can be a problem with Access Databases and can even cause corruption
(IMO, base on anecdotal experience). I would back this database up daily so
that you don't loose too much data, in case corruption does occur.
Additionally, I would compact this database often if you are doing any kind
of data manipulation at all. You can do this programmatically via the JRO
library.

Dim src As String

Dim dest As String

Dim tmpDB As String

Dim je As JRO.JetEngine = New JetEngineClass

tmpDB = CLog.GetAppPath() & "\tmp.mdb"

src = con.ConnectionString ' ADODB connection that has already been
opened

dest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & tmpDB & ";Jet
OLEDB:Engine Type=5"

If con.State <ADODB.ObjectStateEnum.adStateClosed Then

con.Close()

End If

je.CompactDatabase(src, dest)

Kill(m_sDBName) ' m_sDBName is the name of the database and it's location

File.Move(tmpDB, m_sDBName)

con.Open()

je = Nothing

Hope you were looking for something like this. Otherwise, sorry I posted
nonsense for you.

Steve

"T Clancey" <tu**@idcodeware.co.ukwrote in message
news:Ko********************@bt.com...
Hi, I have an app which connects to an Access database on a server, there
are around 10 clients. It's a fairly heavy data intensive app, but most
of the traffic is look up data.

While the system appears to run completely error free around every 6 weeks
the server stops serving the network share where the database resides.
When a client tried to connect you get an error message something like Not
enough resources or disk failure. Resetting the server cleares the
problem. More worrying is a large database corruption that happened just
a couple of days ago.

As far as I can tell my code is correct and I'm not leaving anything open
or connected that shouldn't be. Is there any way to trace or track what
connections and/or resources are being used by each Client? Or if my code
is generating any memory leaks?

Cheers,
Tull.

Oct 12 '06 #3
I think you've got a lot of unneccessary code here. All you need is this:

dim dbPath As String = (path to database here)
dim conString As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" &
dbPath

dim con As New OleDB.OleDBConnection(conString)

Try
con.Open

...your database code here...

Catch ex As OleDbException
...handle database exceptions here...
Catch ex As Exception
...handle CLR exceptions here
Finally
con.close
con.dispose
End Try

Notes:

In ADO.NET, you can call the .Close() method of any object that has one
without worrying about whether it is actually open or not. If it is open,
it will close it. If it is already closed, no action is taken & no
exception is thrown.

You should always open your connection inside of a Try...Catch and you
should always close it and dispose of it in the Try...Catch's Finally so it
will always get closed and disposed, even if there are exceptions thrown
along the way.
"Steve Long" <St**********@NoSpam.comwrote in message
news:O4**************@TK2MSFTNGP03.phx.gbl...
This can be a problem with Access Databases and can even cause corruption
(IMO, base on anecdotal experience). I would back this database up daily
so that you don't loose too much data, in case corruption does occur.
Additionally, I would compact this database often if you are doing any
kind of data manipulation at all. You can do this programmatically via the
JRO library.

Dim src As String

Dim dest As String

Dim tmpDB As String

Dim je As JRO.JetEngine = New JetEngineClass

tmpDB = CLog.GetAppPath() & "\tmp.mdb"

src = con.ConnectionString ' ADODB connection that has already been
opened

dest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & tmpDB & ";Jet
OLEDB:Engine Type=5"

If con.State <ADODB.ObjectStateEnum.adStateClosed Then

con.Close()

End If

je.CompactDatabase(src, dest)

Kill(m_sDBName) ' m_sDBName is the name of the database and it's
location

File.Move(tmpDB, m_sDBName)

con.Open()

je = Nothing

Hope you were looking for something like this. Otherwise, sorry I posted
nonsense for you.

Steve

"T Clancey" <tu**@idcodeware.co.ukwrote in message
news:Ko********************@bt.com...
>Hi, I have an app which connects to an Access database on a server, there
are around 10 clients. It's a fairly heavy data intensive app, but most
of the traffic is look up data.

While the system appears to run completely error free around every 6
weeks the server stops serving the network share where the database
resides. When a client tried to connect you get an error message
something like Not enough resources or disk failure. Resetting the
server cleares the problem. More worrying is a large database corruption
that happened just a couple of days ago.

As far as I can tell my code is correct and I'm not leaving anything open
or connected that shouldn't be. Is there any way to trace or track what
connections and/or resources are being used by each Client? Or if my
code is generating any memory leaks?

Cheers,
Tull.


Oct 13 '06 #4
Hmmm, didn't know that. Thanks Scott. I guess I was just a little scardy
cat... :)

S

"Scott M." <s-***@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I think you've got a lot of unneccessary code here. All you need is this:

dim dbPath As String = (path to database here)
dim conString As String = "Provider=Microsoft.JET.OLEDB.4.0;Data Source="
& dbPath

dim con As New OleDB.OleDBConnection(conString)

Try
con.Open

...your database code here...

Catch ex As OleDbException
...handle database exceptions here...
Catch ex As Exception
...handle CLR exceptions here
Finally
con.close
con.dispose
End Try

Notes:

In ADO.NET, you can call the .Close() method of any object that has one
without worrying about whether it is actually open or not. If it is open,
it will close it. If it is already closed, no action is taken & no
exception is thrown.

You should always open your connection inside of a Try...Catch and you
should always close it and dispose of it in the Try...Catch's Finally so
it will always get closed and disposed, even if there are exceptions
thrown along the way.
"Steve Long" <St**********@NoSpam.comwrote in message
news:O4**************@TK2MSFTNGP03.phx.gbl...
>This can be a problem with Access Databases and can even cause corruption
(IMO, base on anecdotal experience). I would back this database up daily
so that you don't loose too much data, in case corruption does occur.
Additionally, I would compact this database often if you are doing any
kind of data manipulation at all. You can do this programmatically via
the JRO library.

Dim src As String

Dim dest As String

Dim tmpDB As String

Dim je As JRO.JetEngine = New JetEngineClass

tmpDB = CLog.GetAppPath() & "\tmp.mdb"

src = con.ConnectionString ' ADODB connection that has already
been opened

dest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & tmpDB & ";Jet
OLEDB:Engine Type=5"

If con.State <ADODB.ObjectStateEnum.adStateClosed Then

con.Close()

End If

je.CompactDatabase(src, dest)

Kill(m_sDBName) ' m_sDBName is the name of the database and it's
location

File.Move(tmpDB, m_sDBName)

con.Open()

je = Nothing

Hope you were looking for something like this. Otherwise, sorry I posted
nonsense for you.

Steve

"T Clancey" <tu**@idcodeware.co.ukwrote in message
news:Ko********************@bt.com...
>>Hi, I have an app which connects to an Access database on a server,
there are around 10 clients. It's a fairly heavy data intensive app,
but most of the traffic is look up data.

While the system appears to run completely error free around every 6
weeks the server stops serving the network share where the database
resides. When a client tried to connect you get an error message
something like Not enough resources or disk failure. Resetting the
server cleares the problem. More worrying is a large database
corruption that happened just a couple of days ago.

As far as I can tell my code is correct and I'm not leaving anything
open or connected that shouldn't be. Is there any way to trace or track
what connections and/or resources are being used by each Client? Or if
my code is generating any memory leaks?

Cheers,
Tull.



Oct 13 '06 #5

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

Similar topics

4
by: Maurice | last post by:
Hi there, I'm experiencing big memory problems on my webserver. First on an old RedHat 7.2 system, now on an other fresh installed Suse 8.2 system: Linux version 2.4.20-4GB...
0
by: Steve Binney | last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS 2003, I am getting memory leaks and event handle leaks. I am closing all streams and using "using"statements. I have...
2
by: Generic Usenet Account | last post by:
I have been using STL for a long time now, without any problems. Recently we generated a purification report on our software using Rational Purify, and we found some memory leaks. My colleague...
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". ...
16
by: graham.keellings | last post by:
hi, I'm looking for an open source memory pool. It's for use on an embedded system, if that makes any difference. Something with garbage collection/defragmentation would be nice. It should have...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.