Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
when I Use ReportViewer it takes many Memory !
How Can I force memory cleanup in C#?
Posted

You really can't. The GC only work on MANAGED objects, not unmanaged (or COM-based) objects. You run the GC all you want (NOT RECOMMENDED!) and the component is still going to take however much memory it wants.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-Jun-12 23:44pm    
Yes, my 5. Yes, not recommended.
--SA
Rajesh Anuhya 6-Jun-12 1:44am    
Good Point , have my +5
You can use GC.Collect() to run the garbage collector.
However, you cannot control when the reportviewer object will actually be cleared from memory - this can only be controlled by the garbage collector itself.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 5-Jun-12 23:45pm    
Good point, a 5.
--SA
Abhinav S 6-Jun-12 1:42am    
Thanks SA.

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