Hi,
My app does not stop whan I click on the form. I mean, the form is
closing, but the process keeps running in the task manager. So I figured
there are memory leaks or some object's process stuck at some point. Is
there an easy way to know where it comes from other than putting breakpoints
all over the code? 'cause it's huge and I would have to set breakpoints for
at least a day or two
thanks 16 1934
Obviously you have wrong approach on creating and destroying objects
instances.
For all objects that have implemented IDisposable, i suggest you to call
obj.Dispose and set it to obj = Nothing (or null) when you dont need him any
more.
.... it is also possible that you did not exit some loop !?
Regards,
Josip Habjan
URL: http://www.habjansoftware.com
"ThunderMus ic" <NO*******@symp atico.caSPAMATA LL> wrote in message
news:OS******** *****@TK2MSFTNG P12.phx.gbl... Hi, My app does not stop whan I click on the form. I mean, the form is closing, but the process keeps running in the task manager. So I figured there are memory leaks or some object's process stuck at some point. Is there an easy way to know where it comes from other than putting breakpoints all over the code? 'cause it's huge and I would have to set breakpoints for at least a day or two
thanks
ThunderMusic,
What do you mean with keeps running, all day long or a short time?
Cor
Josip, For all objects that have implemented IDisposable, i suggest you to call obj.Dispose and set it to obj = Nothing (or null) when you dont need him any more.
All textboxes, panels, forms, comboboxes and other controls and datasets
etc, which are on the forms, which have IDisposable implemented?
Cor
no .. you misunderstand me.. or i explaned wrong....
see: http://gotdotnet.com/team/libraries/...anagement.aspx
Regards,
Josip Habjan
URL: http://www.habjansoftware.com
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:e%******** ********@TK2MSF TNGP14.phx.gbl. .. Josip,
For all objects that have implemented IDisposable, i suggest you to call obj.Dispose and set it to obj = Nothing (or null) when you dont need him any more.
All textboxes, panels, forms, comboboxes and other controls and datasets etc, which are on the forms, which have IDisposable implemented?
Cor
Josip,
In your first by you supported link I did not see what you wrote, as well
not on the other from Microsoft. Adviced is that when you use unmanaged
resources to implement Idisposable.
This is already implemented in any class that inherits from component. Which
is 80% of the in my opinion in general most used. And as Jon Skeet ones has
checked 20 % of the actual ones. Disposing is mostly done in the higher
class itself. See for that the part in the hidden part of a form or a
component. This you find back in almost all samples from Microsoft about
dispose.
On the blog page there is an explanation that is for me the same as: "What
does it harm to set all integers that you have created in your procedure to
zero". If you don't understand what I want to say with that. Just leave it,
however this tells for me only something about the knowledge from the
writers of this kind of sentences.
I hope this helps,
Cor
Cor,
From my point of view, MS should keep C++ concept on creating and destroying
objects. If you create new object instance, then you are responsible to
destroy it. In framework, GC may implicate on preformances since he decides
when he will call suppressfinaliz e. ( I know that he is waiting for best
time, but anyway )....
I have habit to call object.dispose (and =nothing) for every object instance
that i create (except: Usercontrols, string, integer and related types).
This way, i'm shure that my application will close immediate when i close
it, and will not stay in memory for next 5 minutes (waiting for GC to do his
work) ...
Regards,
Josip Habjan
URL: http://www.habjansoftware.com
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:Oh******** ******@TK2MSFTN GP14.phx.gbl... Josip,
In your first by you supported link I did not see what you wrote, as well not on the other from Microsoft. Adviced is that when you use unmanaged resources to implement Idisposable.
This is already implemented in any class that inherits from component. Which is 80% of the in my opinion in general most used. And as Jon Skeet ones has checked 20 % of the actual ones. Disposing is mostly done in the higher class itself. See for that the part in the hidden part of a form or a component. This you find back in almost all samples from Microsoft about dispose.
On the blog page there is an explanation that is for me the same as: "What does it harm to set all integers that you have created in your procedure to zero". If you don't understand what I want to say with that. Just leave it, however this tells for me only something about the knowledge from the writers of this kind of sentences.
I hope this helps,
Cor
Josip,
I think that we both have a different idea. I keep it by managed code.
However, that from the GC in your application is strange. My experience is
that the GC starts direct as soon as there is a kind of idle time in the
application. Even when the Graphical processor takes over the painting on
screen.
Cor
Josip Habjan <jh*****@SPAM-OFF.net.hr> wrote: I have habit to call object.dispose (and =nothing) for every object instance that i create (except: Usercontrols, string, integer and related types).
You can't call Dispose on most types though - there are plenty of types
which don't implement IDisposable.
Also note that setting a variable to nothing is rarely useful, IME.
This way, i'm shure that my application will close immediate when i close it, and will not stay in memory for next 5 minutes (waiting for GC to do his work) ...
Disposing of an object doesn't garbage collect it.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim Bücker |
last post by:
Following scenario:
The user opens a form, a thread is started to play a sound ...
public void playSoundUsingThread()
{
if (File.Exists(fileLocation))
PlaySound(fileLocation, 0, 0); // winmm.dll
}
|
by: Saradhi |
last post by:
Hi,
I wanted to stop the VS.NET Window from closing inside my C# AddIn.
I Know that OnBeginShutdown() funciton will be called whenever the user tries to close the VS.NET window.
I want to check some conditions and if those conditions doesnt meet, then I want to stop the VS.NET window from closing.
Anybody have any diea?
|
by: John S |
last post by:
When the user clicks the "X" in the upper right-hand corner of a form, how
can I stop the form from closing?
|
by: SteveK |
last post by:
Hi-
I have created a basic login form. If the user enters invalid credentials,
I want to display an error. However, when the user presses the Login
button, the dialog closes... I'm sure this is normal, but how can I interupt
this and keep the dialog alive until I am ready for it to close?
Thanks,
Steve
|
by: **Developer** |
last post by:
When I get a closing event in a MID Child form I don't know if the child
form is closing or the main form is closing.
Is there a way to tell?
Thank
| |
by: Bob Cummings |
last post by:
Greetings
I am sure this is a simple question. But I have "googled" it to death
and have only found one answer that involved a bunch of window's API
calls that I did not understand.
I am a student taking VB.NET and we are studying the Validation event
and how to use it on text boxs. I have set the forms.causevalidation
property to false. But if the user has bad data in the text box and
just wants to quit the program by clicking on...
|
by: Tom |
last post by:
How is the best way to avoid validation when closing a
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means...
|
by: ThunderMusic |
last post by:
Hi,
My app does not stop whan I click on the form. I mean, the form is
closing, but the process keeps running in the task manager. So I figured
there are memory leaks or some object's process stuck at some point. Is
there an easy way to know where it comes from other than putting breakpoints
all over the code? 'cause it's huge and I would have to set breakpoints for
at least a day or two
thanks
|
by: JohnR |
last post by:
I have a form that is presented in an mdi child window. If the user hits
exit or the X button on the titlebar of the mdi child form, that form's
"closing" event fires and in that event I check to see if there are any
outstanding database changes that have not been saved. If there are I give
the user the option of abandoning the closing of the form by issuing a
"e.cancel" statement. This works perfectly if the user hits the X in the...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |