Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help me collect less garbage!

Status
Not open for further replies.

Rewbs

Programmer
May 1, 2002
18
GB
Hi,

My C# app is running much slower than expected (about 3x slower than Java equivalent).

Profiling with the AQTime profiler has revealed that the CLR is collected garbage from heaps Gen0, Gen1 and Gen2 every few second! I assume that this is what is slowing it down.

How can I remedy this? I imagine that increasing the heap size would be a solution, but I don't know how to do this.

Any help would be geat.
Best regards,
Robin.
 
It goes against good software design principles, but you could rewrite the functions that get called all the time to use fewer local variables.

Chip H.
 
Isn't there a way I could just convince the CLR to allocate more memory to the heap? This would surely help as less GC would be required.

Cheers,
Robin
 
If you're taking a performance hit by the garbage collector, then you may want to consider manually releasing your objects rather than relying on the garbage collector to take care of it for you. This would save yourself a lot of the overhead that is used by the garbage collector when it searches for releasable objects. Also, you'd save yourself the performance hit when the garbage collector actually performs the release process.

Here's an excellent resource that would be worth several minutes of your time.

Neil Konitzer
Freisoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top