PC Review


Reply
Thread Tools Rate Thread

Connection/Memory Question

 
 
=?Utf-8?B?SmltIEhlYXZleQ==?=
Guest
Posts: n/a
 
      22nd Jul 2005
Hello, I am hoping this is a simple question....
If I am processing a file and re-using the same connection object be
creating new Command objectes for each of the records on the file, do I need
to run the command.Dispose() method when I am done with each command? My
memory usage continues to grow and grow and I am trying to figure out why it
continues to grow and grow until it finally fails with an out of memory
condition.

Can I reuse the same command object for inserting multiple records into the
database - If I can, maybe this would help with my memory problem.

Thanks in advance for your assistance!!!
 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      22nd Jul 2005
You don't need to call Dispose (though some will argue that you should
always call Dispose anything that has this method). It won't hurt to call
it, but calling it isn't going to gain you anything.

You can reuse command objects, but not reusing them shouldn't cause memory
problems.

I would guess your memory problem stems from something else.

"Jim Heavey" <(E-Mail Removed)> wrote in message
newsFC7E417-2DB7-487F-B4B3-(E-Mail Removed)...
> Hello, I am hoping this is a simple question....
> If I am processing a file and re-using the same connection object be
> creating new Command objectes for each of the records on the file, do I
> need
> to run the command.Dispose() method when I am done with each command? My
> memory usage continues to grow and grow and I am trying to figure out why
> it
> continues to grow and grow until it finally fails with an out of memory
> condition.
>
> Can I reuse the same command object for inserting multiple records into
> the
> database - If I can, maybe this would help with my memory problem.
>
> Thanks in advance for your assistance!!!



 
Reply With Quote
 
Robbe Morris [C# MVP]
Guest
Posts: n/a
 
      22nd Jul 2005
Post the offending section of code.

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp



"Jim Heavey" <(E-Mail Removed)> wrote in message
newsFC7E417-2DB7-487F-B4B3-(E-Mail Removed)...
> Hello, I am hoping this is a simple question....
> If I am processing a file and re-using the same connection object be
> creating new Command objectes for each of the records on the file, do I
> need
> to run the command.Dispose() method when I am done with each command? My
> memory usage continues to grow and grow and I am trying to figure out why
> it
> continues to grow and grow until it finally fails with an out of memory
> condition.
>
> Can I reuse the same command object for inserting multiple records into
> the
> database - If I can, maybe this would help with my memory problem.
>
> Thanks in advance for your assistance!!!



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      23rd Jul 2005
Marina,

> You don't need to call Dispose (though some will argue that you should
> always call Dispose anything that has this method). It won't hurt to call
> it,


Every instruction needs some time to process no matter how less it is.

Just my idea

:-) (I know we share that idea)

Cor


 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      23rd Jul 2005
Jim,

Why would you use the same connection object all the time. In my idea are
you trying to do something without any sense. OOP is based on creating
objects everytime new and use them when needed. When done well than the
mechanism of Net will delete them properly.

Just my thought,

Cor


 
Reply With Quote
 
Marina
Guest
Posts: n/a
 
      25th Jul 2005
Right, it might take some time. I meant more in terms of not breaking
code.

"Cor Ligthert [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Marina,
>
>> You don't need to call Dispose (though some will argue that you should
>> always call Dispose anything that has this method). It won't hurt to
>> call it,

>
> Every instruction needs some time to process no matter how less it is.
>
> Just my idea
>
> :-) (I know we share that idea)
>
> Cor
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection and memory susan Windows Vista Networking 2 15th May 2007 05:44 PM
Internet connection share/view wireless connection question Jim Marshall Windows XP Networking 3 12th Feb 2006 10:09 PM
memory question - anyone know of reputable sellers on Ebay for memory? db Computer Hardware 9 9th May 2004 04:33 AM
#1 prob...bad memory connection Godzilla Pimp DIY PC 0 10th Mar 2004 03:30 PM
Memory Question - outcome of exceeding the memory limits of a machine. John B. Computer Hardware 4 4th Nov 2003 12:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 PM.