|
Hi,
I have created an object for a class i have written.
How to delete this object? I dont want to wait for the garbage collector to run its algorithm neither call the GC explicitly.
Gautham
|
|
|
|
|
Why do you want the object deleted?
If you are using some unmanaged resources that you need to release, implement the IDisposable interface.
---
single minded; short sighted; long gone;
|
|
|
|
|
search google for destructor
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
But the destructor (or Finalizer as it is also called) won't run until the garbage collector does. And then when a destructor is in place it slows garbage collection down because it has additional code to run.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
thank you for the explanation
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Are you just copying what ever looks the more convincing answer so far?
NOTE: This was originally a reply to satips. That post has now been deleted.
-- modified at 6:11 Monday 25th June, 2007
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
To re-emphasise what Guffa said. If you have unmanaged resources, or otherwise use objects that also implement IDisposable then you should implement IDisposable to free up or dispose of those resources. If those conditions are not met then let the garbage collector do its job - it is better at it than anyone else.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
The reason for this explicit object release is in our application in we are creating n number of objects for a specific operation after that operation is finished we no longer require thise objects
We thought that the performance would be better if we explicitly release objects than waiting for the GC to do at later stages!
So the answer is ti implement IDisposable! thank you!
Gautham
|
|
|
|
|
gauthee wrote: So the answer is ti implement IDisposable!
Depends. Do you have objects that already implement IDisposable to dispose of in the object, or do you manage any unmanaged resources in the object? If the answer is no to either then IDisposable won't do anything for you.
Remember, the Garbage Collector knows more about the system state and when it would be an opportune moment to garbage collect things than you do because it can constantly fine tune itself.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
|
This is almost always a bad idea as it ultimately ends up slowing down your application.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Scott Dorman wrote: This is almost always a bad idea as it ultimately ends up slowing down your application.
I Totaly agree with you there, but since he needs (for some reason) to force the GarbageCollector to collect, this is the way.;)
GanDad
|
|
|
|
|
how can I get into outlook by a click event?,help me
Hi,Im Razana
|
|
|
|
|
razanabanu wrote: how can I get into outlook by a click event?,help me
What you want to do is unclear. Can you be more specific?
So you want to create an Outlook Add-in or want to open an Outlook window from your application?
---
Hakuna-Matata
It means no worries for the rest of your days...
It's our problem free, Philosophy
"I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
|
|
|
|
|
yes,I want to open an Outlook window from my application...
Hi,Im Razana
|
|
|
|
|
|
hi guys,
I want to open the outlook and add a RSS feed into it... Basically i have the URL of the rss and now just want to add it in Outlook... How can i achieve that??
can anyone help me out..please
thanks,
huzefa
|
|
|
|
|
|
Hi,friends!!..When I click a linkbutton it has to take me the new window..how can I do this?.I've checked with properties of a link button[Target=Self..like that].but its not working..
Hi,Im Razana
|
|
|
|
|
razanabanu wrote: When I click a linkbutton it has to take me the new window..how can I do this?
You can't do that. A linkbutton does a postback, and from server code you can't open a new window.
Just use a regular link with target="_blank" .
---
single minded; short sighted; long gone;
|
|
|
|
|
Were you able to inject Attributes.Add and target _blank to LInkButton from CodeBehind?
|
|
|
|
|
How do i multi-thread a function of type
bool MethodName (object obj) ?
coz the ParametrizedThreadStart delegate only allows for vod MethodName (object obj)
- Projjal
|
|
|
|
|
You can't return anything from the method that you use to start the thread, as the call doesn't wait for the thread to end.
---
single minded; short sighted; long gone;
|
|
|
|
|
guffa is right.. u can't do that.
else i think u should use global variables if possible to store bool value.
|
|
|
|
|
thank you guffa and nouman
- Projjal
|
|
|
|