473,785 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dispose calling GC.Collect? Framework 1.0

Does anyone know of any case in which the CLR explicitly calls GC.Collect? I
have a form that when unloaded, shows # of induced GC's incremented by 5.
This is killing performance.

I have a feeling that it's related to calling Dispose on a particular
control class like DataGrid, ListView, etc.

TIA,
Eric

Nov 15 '05 #1
2 1672
Eric,

The CLR can collect at any time. I think what you meant to say was does
anyone know a case where a class in the framework calls GC.Collect? I think
that there are some that do this (especially ones that are using COM
interop), but I would not say that it is outside the realm of possibility
that it could be calling this.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldin o=at=exisconsul ting<dot>com

"Eric Cadwell" <ec******@ns.in sight.com> wrote in message
news:uT******** ******@TK2MSFTN GP11.phx.gbl...
Does anyone know of any case in which the CLR explicitly calls GC.Collect? I have a form that when unloaded, shows # of induced GC's incremented by 5.
This is killing performance.

I have a feeling that it's related to calling Dispose on a particular
control class like DataGrid, ListView, etc.

TIA,
Eric

Nov 15 '05 #2
Yes that is what I was fishing for, but it appears that it may not be
related to calling Dispose. In fact it is happening during the load of my
form!

Performance Monitor is showing an increase in # of induced GC of 6 per load
of a single form in my application. I have no explicit calls to GC in my
code.

Thanks,
-Eric
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:uX******** ******@TK2MSFTN GP12.phx.gbl...
Eric,

The CLR can collect at any time. I think what you meant to say was does anyone know a case where a class in the framework calls GC.Collect? I think that there are some that do this (especially ones that are using COM
interop), but I would not say that it is outside the realm of possibility
that it could be calling this.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldin o=at=exisconsul ting<dot>com

"Eric Cadwell" <ec******@ns.in sight.com> wrote in message
news:uT******** ******@TK2MSFTN GP11.phx.gbl...
Does anyone know of any case in which the CLR explicitly calls GC.Collect?
I
have a form that when unloaded, shows # of induced GC's incremented by

5. This is killing performance.

I have a feeling that it's related to calling Dispose on a particular
control class like DataGrid, ListView, etc.

TIA,
Eric


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
5312
by: Ken Durden | last post by:
I am in search of a comprehensive methodology of using these two object cleanup approaches to get rid of a number of bugs, unpleasantries, and cleanup-ordering issues we currently have in our 4-month old C#/MC++ .NET project project. I'd like to thank in advance anyone who takes the time to read and/or respond to this message. At a couple points, it may seem like a rant against C# / .NET, but we are pretty firmly stuck with this approach...
24
7693
by: Jazper | last post by:
hi i have this problem. i made a class deverted by CRootItem with implementation of IDisposable-Interface. i made a test-funktion to test my Dispose-Method.... but when set a breakpoint in my Dispose-Method and call the GC nothing happend!!! my Disposemethod has never been called!! so the GC dont call my Dispose-Method although I implemented IDisposable? what am i doing wrong?
13
1660
by: | last post by:
I'm curious if anyone knows why the C# and VB.NET compilers don't automatically call Dispose() on objects that support IDisposable when they go out of scope. I asked a co-worker and his response was that IDisposable is a library feature and not a language feature. To which I pointed out that the using() statement calls Dispose() and foreach uses IEnumerator. So why leave it to developers to screw up when the compiler could conceivable...
4
2038
by: xyu | last post by:
Hello, First I would like to thank anyone who helps me, much appreciated. I'm a c++ programmer just started using c#. I'm writing some big hash table so I want to actively take my object off the heap and release the memory when it's deleted from the hash table so that GC recollection does not need to run that frequently. I read up examples about Dispose method in MSDN. What I find very strange is that it's all talking about how to...
7
4467
by: Tamir Khason | last post by:
I have a class public class Foo { public Foo() { DoSomething() } } I want to be able to do something else while the class enters GC - no more
3
9973
by: Vagabond Software | last post by:
Scenario: The end-user selects File-Save from my applications (WinForm) menu, specifies a filename, and waits waits for my app to write the contents of a dataset to an Excel workbook. The SaveXLReport method completes successfully, calls myXLClass.Dispose, and returns control to the user form at a base state. At this point, there is still an EXCEL.EXE in processes and the specified workbook cannot be saved until that process is ended from...
156
5905
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created inside a method call. dim myvar as new object1 object1.dosomethingmethod(new object2) Note that object 2 has a dispose method but how do I dispose of it unless I do the following:
44
8274
by: Smokey Grindle | last post by:
I have a list box on my form, but I need to databind it to a data table that is a private member of the form's class... so I basically have Public Class MyForm priate m_MyTable as new datatable End Class now where would I properly dispose of this? In the finalize method? I am loading the data for the table in a subroutine that is executed at form load, of course all the commands tied to it are wrapped in using blocks, but
3
12124
by: Radenko Zec | last post by:
I have filled generic list with data on one form. When I close form generic list stay in memory waiting GC to collect. I want to implement code on form close to dispose generic list.
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.