Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
OutOfMemoryException Filling DataTable
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
SnapDive  
View profile  
 More options Oct 21, 12:35 am
Newsgroups: microsoft.public.dotnet.framework
From: SnapDive <SnapD...@community.nospam>
Date: Tue, 20 Oct 2009 10:35:43 -0400
Local: Wed, Oct 21 2009 12:35 am
Subject: OutOfMemoryException Filling DataTable

I am doing a simple select on a MSSQL 2005 database and asking for
10,000 rows using classic ADO.NET. I am getting an out of memory
exception. I need this big table, is there any way to back the
DataTable with a disk-resident stream or something else that will let
me "go big"? I don't care if it is slow or not.

Thanks.

DataTable tb = new DataTable();
try
{
using ( sqlco sqlco = new sqlco( myconnstring ) )
{
sqlco.Open();
using ( da da = new da( "select top 10000 id,key,value from mytable" ,
sqlco ) )
{
        da.Fill( tb );

}
}
}

....

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesse Houwing  
View profile  
 More options Oct 21, 12:54 am
Newsgroups: microsoft.public.dotnet.framework
From: Jesse Houwing <jesse.houw...@newsgroup.nospam>
Date: Tue, 20 Oct 2009 16:54:15 +0200
Local: Wed, Oct 21 2009 12:54 am
Subject: Re: OutOfMemoryException Filling DataTable
* SnapDive wrote, On 20-10-2009 16:35:

What do you need these 10.000 rows for? Can you
- Page the result set and load them per 10 or 100 or even 1000?
- Use a DataReader and only have one row in memory at the time?
- Upgrade to SQL 2008 and use the new FILESTREAM feature
(http://msdn.microsoft.com/en-us/library/cc716724.aspx)?

As long as we have no clue on whet you're trying to do with these
enormous amounts of data, we can't give you a proper answer.

--
Jesse Houwing
jesse.houwing at sogeti.nl


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SnapDive  
View profile  
 More options Oct 23, 6:57 am
Newsgroups: microsoft.public.dotnet.framework
From: SnapDive <SnapD...@community.nospam>
Date: Thu, 22 Oct 2009 16:57:35 -0400
Local: Fri, Oct 23 2009 6:57 am
Subject: Re: OutOfMemoryException Filling DataTable
Upgrading is not an option. Using a DataReader is not an option.
Paging would be least-intrusive to the app, but would still impact
existing code. I'd like to let callers keep their same interface but
behind the scenes swap in/out what is needed from the "in memory"
construct, much the same way a memory-mapped file behaves.

Thanks.

On Tue, 20 Oct 2009 16:54:15 +0200, Jesse Houwing


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesse Houwing  
View profile  
 More options Oct 26, 3:22 am
Newsgroups: microsoft.public.dotnet.framework
From: Jesse Houwing <jesse.houw...@newsgroup.nospam>
Date: Sun, 25 Oct 2009 17:22:39 +0100
Local: Mon, Oct 26 2009 3:22 am
Subject: Re: OutOfMemoryException Filling DataTable
* SnapDive wrote, On 22-10-2009 22:57:

> Upgrading is not an option. Using a DataReader is not an option.
> Paging would be least-intrusive to the app, but would still impact
> existing code. I'd like to let callers keep their same interface but
> behind the scenes swap in/out what is needed from the "in memory"
> construct, much the same way a memory-mapped file behaves.

You could just show them 1000 rows and require to filter more (if there
is such a facility) due to the amount of records.

Other than that, there is no way to map a dataset to disk and bind to
it. The grid showing the data would still have to retrieve most of the
data back into memory anyway.

You could always decide to fetch the next batch of records as th euser
scrolls down. (like Windows Media Player does when scrolling through the
media library).

I think there isn't going to be a "non-intrusive-way" to fix this.
Jesse

--
Jesse Houwing
jesse.houwing at sogeti.nl

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google