Click here to Skip to main content
15,909,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I currently have developed a system of which aprrox 1.3million records are being imported.

Once the files are imported the table that the files are updated in are then updated so that the import mathches the id's of the other tables and the necesary tables can be updated

I have managed to get my process to work though i have been having an issue on my memory that once the process completes it doesnt seem to release the physical memory used.

when the process runs it takes up about 40% of physical memory available

I use the following vb.net code to call my stored procs

using con as new sqlconnection(ConnString)
Con.open()
dim cmd as new sqlcommand
cmd = ("execute proc1",con)
cmd.executenonQuery()
con.close()
end using

there are about 5 stored procs that use this code.

Is there a way that i could release the memory once the process completes?
Posted

If you're looking in TaskManager to see how much memory your app is using, it's lying to you.

TaskManager is showing you how much memory the .NET CLR has RESERVED for your application, not how much it's actually using. This is the "managed heap". If Windows wants the memory back, the CLR is happy to free whatever it can from the heap and return it. It does a good job at it to, so there's nothing to "tune".

If you want to see how much it's using, open ProcMon and use the .NET Memory counters.

It's also possible that your code is leaking resources. Perhaps you're not Disposing objects when you're done with them??
 
Share this answer
 
You should check your stored procedures. I guess you are using cursors to walk through the data. If so, you should consider cleaning up the variables in the stored procedures. Also consider not running through all records at once, instead create batches of 10000 records and work on them. This should reduce memory usage. You have not that much control about the memory usage in sql server, so try to keep the amount low with working on only low numbers of data.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900