473,387 Members | 3,781 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,387 software developers and data experts.

Memory Issue

I have a program which is looping through a data reader, taking the record
which is read, creating an instance of a class which respresents that record,
and then inserting that record into a database.

As I am looking at the task manager in the performance tab, the PF Usage
continues to rise until the machine halts with a unavailable memory error.

The procedures which insert the record are all static methods. The only
substative thing which I can see which would/should be eating at the memory
is the creation of an instance of the class which holds the row in the table.
After I am done inserting the record, is there something I need to do to
remove the record from memory? Why would PF Usage continue to rise and
seeminly never drop size?

Here is an example of my loop.....
while (dr.Read())
{
readCnt++;
switch (tblToCopy)
{
case "PS_ALLOC_STEP_TBL":
PS_ALLOC_STEP_TBL rec = new
DBUtilities.GL.Tables.PS_ALLOC_STEP_TBL(dr);
ok =
PS_ALLOC_STEP_TBL_DAL.Insert_PS_ALLOC_STEP_TBL(cmT o, rec);
break;
}
if (!ok)
{ TerminateProcessing(); }
}
dr.Close();

Thanks in advance for your assistance!
Feb 8 '07 #1
3 1283
Try using a DataSet and closing the connection. Reader keeps the connection
open.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"JimHeavey" wrote:
I have a program which is looping through a data reader, taking the record
which is read, creating an instance of a class which respresents that record,
and then inserting that record into a database.

As I am looking at the task manager in the performance tab, the PF Usage
continues to rise until the machine halts with a unavailable memory error.

The procedures which insert the record are all static methods. The only
substative thing which I can see which would/should be eating at the memory
is the creation of an instance of the class which holds the row in the table.
After I am done inserting the record, is there something I need to do to
remove the record from memory? Why would PF Usage continue to rise and
seeminly never drop size?

Here is an example of my loop.....
while (dr.Read())
{
readCnt++;
switch (tblToCopy)
{
case "PS_ALLOC_STEP_TBL":
PS_ALLOC_STEP_TBL rec = new
DBUtilities.GL.Tables.PS_ALLOC_STEP_TBL(dr);
ok =
PS_ALLOC_STEP_TBL_DAL.Insert_PS_ALLOC_STEP_TBL(cmT o, rec);
break;
}
if (!ok)
{ TerminateProcessing(); }
}
dr.Close();

Thanks in advance for your assistance!
Feb 8 '07 #2
Seem that creating a dataset would agrevate the problem and not make it
better as if you create a dataset and itterate over the dataset, you have to
have enough memory to hold all of the records retrieved in addition to the
existing memory issue of taking each one of those records and creating an
instance of a class for that row and then inserting it into the database.

Feb 8 '07 #3
Maybe so. But you aren't going to find out unless you try it.
Cheers,
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"JimHeavey" wrote:
Seem that creating a dataset would agrevate the problem and not make it
better as if you create a dataset and itterate over the dataset, you have to
have enough memory to hold all of the records retrieved in addition to the
existing memory issue of taking each one of those records and creating an
instance of a class for that row and then inserting it into the database.
Feb 8 '07 #4

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

Similar topics

0
by: Jason | last post by:
We are developing a VB.NET database application, using windows forms and Microsoft Access. The application requires dynamic reports, where the users change data on the forms, if a report is...
7
by: Felix E. Klee | last post by:
Hi, why does the memory consumption of the program attached below increase steadily during execution? Shouldn't vector::reserve() allocate one large memory chunk of memory that doesn't change...
9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
0
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is...
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
2
by: a_agaga | last post by:
Do you know are there some reasons why many do not make processes to communicate through memory? Why network connections (sockets) are used so commonly in IPC (inter process communication)...
3
by: san | last post by:
we cannot stop the application from increasingly use memory. The CRM Worker process will continually consume memory but not release it back to the system. Please research into how to make the...
7
by: =?Utf-8?B?Tmlrb2xheSBFdnNlZXY=?= | last post by:
Hi! I know this topic has been discussed a long way, but I haven't found any apparent solution (maybe I shouldn't be looking for a one :)) I have a very simple application with one page and with...
10
by: Daniel Peterson | last post by:
I'm responsible for a pair of IIS 6 webservers that run our production ASP.Net application. We push code on a monthly basis, and about two weeks after our October code push, we started to run into...
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: 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...
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,...

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.