TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andres Lopez
NA
1
0
Memory keep growing
Feb 21 2008 7:11 PM
Hi,
I´m having a wear problem with an application. When I start the application the memory start to grow and never stops. I´m entering to this routine many times
class ImageDatabaseHandler
{
private bool blDBResult = true;
private string strResultCode = "3009";
string query = "";
readonly ConnectionString connString = new ConnectionString();
public string StrResultCode
{
get { return strResultCode; }
set { strResultCode = value; }
}
public bool getNextFingerprintMinutia(Int64 intThisID, out Int64 intNextID, out string strMinutia/*, OracleConnection myConnection*/)
{
intNextID = 0;
strMinutia = "";
OracleConnection myConnection;
using (myConnection = connString.GetMyConnection())
{
query = string.Format("Select * From (Select * from VCS_IMAGE Where IMAGE_ID > '{0}' and IMAGE_FORMAT = 5005 order by IMAGE_ID ASC) where ROWNUM <=1", intThisID);
using (OracleCommand myCommand = new OracleCommand(query, myConnection))
{
try
{
myConnection.Open();
using (OracleDataReader reader = myCommand.ExecuteReader())
{
blDBResult = reader.Read();
// Read did not cause an exception, blDBResult will contain the Read status (true or false)
if (blDBResult)
{
try
{
intNextID = (Int64)reader["IMAGE_ID"];
}
catch (InvalidCastException)
{
intNextID = -1;
}
try
{
using (OracleClob myOracleClob =reader.GetOracleClob(7))
{
strMinutia = myOracleClob.Value;
myOracleClob.Close();
}
//myOracleClob.Dispose();
}
catch (Exception )
{
strResultCode = "3053";
blDBResult = false;
}
}
reader.Close();
}
myConnection.Close();
}
catch (Exception)
{
blDBResult = false;
}
finally
{
myConnection.Close(); //Added
myConnection.Dispose();
}
}
}
return blDBResult;
}
}
The connection string routine is:
class ConnectionString
{
private string host = "";
private string port = "";
private string serviceName = "";
private string userId = "";
private string userPassword = "";
private string strConnection;
public string Host
{
get { return host; }
set { host = value; }
}
public string Port
{
get { return port; }
set { port = value; }
}
public string ServiceName
{
get { return serviceName; }
set { serviceName = value; }
}
public string UserId
{
get { return userId; }
set { userId = value; }
}
public string UserPassword
{
get { return userPassword; }
set { userPassword = value; }
}
private OracleConnection myConnection = null;
//OracleConnection myConnection = new OracleConnection(strConnection);
public OracleConnection GetMyConnection()
{
using (StreamReader objReader = new StreamReader("c:\\cc17v.cfg"))
{
host = objReader.ReadLine();
port = objReader.ReadLine();
serviceName = objReader.ReadLine();
userId = objReader.ReadLine();
userPassword = objReader.ReadLine();
objReader.Close();
objReader.Dispose();
}
strConnection = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={2})));User Id = {3};Password = {4}; ", host, port, serviceName, userId, userPassword);
myConnection = new OracleConnection(strConnection);
myConnection.Close();
return myConnection;
} // Connect to the DB
//}
}
I´ll appreciate any help you can give me. I don´t know if it´s the way how I´m creating the objects for connection, adapter or reader, aparently those are not been disposed propertly.
The Idea of this application is to run it for long time and I mean long time processing so the memory should be constant in order to keep runing otherwise it´ll get a leak of memory.
thanks a lot.
Reply
Answers (
0
)
Request for the permission of type 'System.Data.SQLClientPermission'...
SqlException -E.Library-TableValueFunctions