We help IT Professionals succeed at work.

correct way to perform garbage collecting

gr8life
gr8life asked
on
Medium Priority
258 Views
Last Modified: 2010-04-23
I am working on a project which I am trying desperately to optimize its performance.  I want to perform some reading and writing of a lot of data and perform some garbage collecting as the data is processed.  Anything working code will help.  I posted a question which some very good advice was offered, but I can’t seam to get the advice to work correctly.  I believe it is because I don’t quite understand how to make garbage collecting work efficiently.  My question is I want any good source code for using gc.collect properly.  I really want to try to improve a process where I believe garbage collecting may help alleviate some bottlenecks.  

Thanks you’re your time and valuable expertise,
Gr8life
Comment
Watch Question

if you try to do your own garbage collection, rather than allowing the GC to take place only when really necessary, you will actually get worse performance, rather than better.  

AW

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Top Expert 2006
Commented:
As Arthur_Wood said, you're really not going to gain any advantages by doing your own GC'ing.  If anything, you might want to call the GC right after you've just done a Dispose/Dereference of large sets of data and/or forms.  The problem, though, is that by forcing a GC, you're causing extra work for the system, and it can really be a ding in performance.

Author

Commented:
As I stated I am researching as much as I can to optimize some code and I thought this may be a way to speed up the application. However after reading the posts here I see this approach is not the correct method. Thank you for your quick assistance and expertise.  I will research other options.
Have a great day,
Gr8life
glad to be of assistance.
 good luck on your search for performance gains.

AW
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.