Forums Register Login

Regarding finalize method

+Pie Number of slices to send: Send
Hi Friends,
I'm trouble with finalize and garbage collection.
when an object is eligible for garbage collection,does the finalize() method get called immediately on that object?
+Pie Number of slices to send: Send
Finalize method can be used before garbage collector claims the memory used by the object.It can't be guaranteed when garbage collector will be invoked so you should not release any critical memory resources into this method.For that you can use the finally method with try catch block.

Its like a last wish notice before GC hangs the object to death...
+Pie Number of slices to send: Send
Welcome to the Ranch , Harpreet Ahuja
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 921 times.
Similar Threads
Garbage collection questin from Danchisolm
GC from j@whiz
Garbage collection will be triggered and finalize method will be called ?
finalize
Garbage Collection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:04:25.