|
-
Jul 28th, 2004, 09:04 AM
#1
Thread Starter
Frenzied Member
Releasing memory for DataTables
I have a service that is pulling alot of records from a SQL Server table in a DataSet. This process takes up alot of memory, which is to be expected. But when the process is finished, I am clearing all the data I thought with:
MyDataSet.Tables("MyTable1").Rows.Clear()
MyDataSet.Tables("MyTable2").Rows.Clear()
MyDataSet.Tables("MyTable3").Rows.Clear()
But I'm monitoring the memory the process is doing and this isn't freeing the memory. Is there something I need to do to flush the memory?
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 10:25 AM
#2
Thread Starter
Frenzied Member
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 10:49 AM
#3
I wonder how many charact
The GC will free it when it gets to it... (when the framework decides it needs more memory or has spare time). You are just stating that data isnt need anymore, so when big old GC comes along, it will free that memory.
If you truly do not need the tables, you should probably remove the table from the dataset..
-
Jul 28th, 2004, 10:59 AM
#4
Thread Starter
Frenzied Member
I will still need the table for the next iteration in the service, I just need to clear it and load it with the next generation of data. Thanks for the input though. Maybe if I GC.Collect() it will clean up the memory for me?
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 11:13 AM
#5
Thread Starter
Frenzied Member
Hmmmm....GC.Collect() didn't really help either.
Last edited by SeanGrebey; Jul 28th, 2004 at 02:39 PM.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 01:50 PM
#6
Thread Starter
Frenzied Member
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 02:23 PM
#7
I wonder how many charact
You don't need help. You're fine.
-
Jul 28th, 2004, 02:24 PM
#8
Thread Starter
Frenzied Member
If I was fine this would be working and I'd be sitting on the back patio drinking a beer and marinating some Ny Strips.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 02:25 PM
#9
Frenzied Member
exactly how much memory is being eaten up? and, is that number increased with each use of the dataset? If it's not a whole whole lot, and it's not affecting performance, i would just not worry about it and rely on the garbage man.
-
Jul 28th, 2004, 02:29 PM
#10
I wonder how many charact
Originally posted by SeanGrebey
If I was fine this would be working and I'd be sitting on the back patio drinking a beer and marinating some Ny Strips.
IS your program erroring? If not, you don't have a problem. The framework is reserving that memory. Only the GC will free it for you.
-
Jul 28th, 2004, 02:38 PM
#11
Thread Starter
Frenzied Member
I'm done with the memory but I still have almost 500 MB of memory tied up that I am no longer using that isn't being released in a timely fashion. That's not really exceptable.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 03:04 PM
#12
I wonder how many charact
Being released to whom?
I could be totally misunderstanding your problem... in which case forgive me for this rationale below:
If I have 2 GB of RAM in my machine, and I run a proc that uses 500mb each time it runs... the framework will probably consume 1.5gb (3 runs), before it decides there's not enough physical memory to continue, so it must collect old objects (datatables in your case).
Now, if the system the app is running on, needs more memory, the GC will be invoked and clean up more often.
But the whole idea of RAM is to make manipulations faster. So the framework is going to devour what is available because nothing else is using that memory, and why should the .NEt framework let it go to waste just sitting there full of 0's....? It should use that memory instead, and it does. You paid for that memory, be happy its being put to good use!
Last edited by nemaroller; Jul 28th, 2004 at 03:09 PM.
-
Jul 28th, 2004, 03:11 PM
#13
Thread Starter
Frenzied Member
The problem is that I am getting noticeable slowness in the machine because too much memory is being held on too after i am done using it.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 28th, 2004, 03:19 PM
#14
I wonder how many charact
Then its your architecture most likely...
How many tables belong to this dataset? How many columns are in each table?
And when you say you need to clear them.... could use just drop the tables and reinstate them?
Try:
Tables.Clear
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|