DataSet Question

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

In my application at runtime I fill a dataset from a database using a stored
procedure and then bind it to a combo box. My question is after I bind it
is the dataset still in memory? I do this for 6 or 7 combo boxes and I do
not need the dataset after I bind it.

Thanks in advance
 
Hi Jack,

The Common Language Runtime uses Garbage Collection to clear the useless
objects on the managed heap. When there is a reference pointing the
dataset, it will never be considered as a garbage to be collected. In fact,
you needn't worry about the problem with releasing memory on the managed
heap. Just leave it to the CLR. If you don't want the dataset, try to use
ComboBox.Items.Add() method to add items instead of binding it. Then the
dataset might be collected next time the CLR performs GC.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "Jack" <[email protected]>
| Subject: DataSet Question
| Date: Tue, 14 Oct 2003 16:39:28 -0600
| Lines: 8
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 64.207.45.37
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63656
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| In my application at runtime I fill a dataset from a database using a
stored
| procedure and then bind it to a combo box. My question is after I bind it
| is the dataset still in memory? I do this for 6 or 7 combo boxes and I do
| not need the dataset after I bind it.
|
| Thanks in advance
|
|
|
 
Thanks for the reply. So, my question is when I pass in
the dataset to a method that binds it and when the
dataset goes out of scope the GC will release it when it
collects? ANother question was when it is bound to the
combobox is it not release into memory until the form is
closed?

Thanks
 
Hi Jack,

Whenever there is a reference to the dataset, it will not be collected. So
when you bind the dataset to a combobox, only when the combobox goes out of
scope will the GC collect the dataset. Generally, the ComboBox goes out of
scope when the form closes.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "Jack" <[email protected]>
| Sender: "Jack" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: DataSet Question
| Date: Wed, 15 Oct 2003 08:01:38 -0700
| Lines: 74
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOTLTv6gc/HgafyT+CA7aZc0NrnAQ==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63697
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Thanks for the reply. So, my question is when I pass in
| the dataset to a method that binds it and when the
| dataset goes out of scope the GC will release it when it
| collects? ANother question was when it is bound to the
| combobox is it not release into memory until the form is
| closed?
|
| Thanks
|
|
|
| >-----Original Message-----
| >Hi Jack,
| >
| >The Common Language Runtime uses Garbage Collection to
| clear the useless
| >objects on the managed heap. When there is a reference
| pointing the
| >dataset, it will never be considered as a garbage to be
| collected. In fact,
| >you needn't worry about the problem with releasing
| memory on the managed
| >heap. Just leave it to the CLR. If you don't want the
| dataset, try to use
| >ComboBox.Items.Add() method to add items instead of
| binding it. Then the
| >dataset might be collected next time the CLR performs GC.
| >
| >If anything is unclear, please feel free to reply to the
| post.
| >
| >Kevin Yu
| >=======
| >"This posting is provided "AS IS" with no warranties,
| and confers no
| >rights."
| >
| >--------------------
| >| From: "Jack" <[email protected]>
| >| Subject: DataSet Question
| >| Date: Tue, 14 Oct 2003 16:39:28 -0600
| >| Lines: 8
| >| X-Priority: 3
| >| X-MSMail-Priority: Normal
| >| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V6.00.2800.1165
| >| Message-ID: <[email protected]>
| >| Newsgroups: microsoft.public.dotnet.framework.adonet
| >| NNTP-Posting-Host: 64.207.45.37
| >| Path:
| >cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!
| TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
| >8.phx.gbl!TK2MSFTNGP12.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:63656
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| >|
| >| In my application at runtime I fill a dataset from a
| database using a
| >stored
| >| procedure and then bind it to a combo box. My
| question is after I bind it
| >| is the dataset still in memory? I do this for 6 or 7
| combo boxes and I do
| >| not need the dataset after I bind it.
| >|
| >| Thanks in advance
| >|
| >|
| >|
| >
| >.
| >
|
 
Back
Top