Finalization is intended for questions regarding programmatically releasing memory in conjuction with garbage collection, external resources and weak references.
I would like to force inheriting classes to define a destructor in Fortran >= 2008.
So far I have tried several variations of:
type, abstract :: parent_class_t
contains
final, deferred, pass :: cleanup
end type
which don't even compile.
How do…
I want to create a Java wrapper against some third-party library with C interface. The library operates on a complex Context entity which is essentially a C++ object (C++ is used internally in that library, but API is in pure C). It would be natural…
I have heard that in Joshua Bloch book written that allocation and memory collection might be increased to 430 times if we override finalize method.
It is clear for me that memory collection can work slower because additional iteration requred for…
Since the process will be killed by OS and all memory allocated will be recycled anyway, is it OK not to free objects/resources in the unit finalization section?
For example,
unit Threading;
interface
implementation
var threadpool:…
If suppose an object implements the Finalize method but inside it refers an alive static object of the application (bad design! but very possible).
Now when GC kicks in and finalises the object by putting it in Finalization queue and then move it to…
I have a weakly-referenced array of weak references to further objects like so:
public class Foo{
WeakReference[]> cache;
}
public class Bar{
private final WeakReference[] ownerCache;
}
The array itself is weakly…
I'm starting to learn about GC and finalization, and I've come across quite a simple example where the behaviour of the application is quite unexpected to me.
(Note: I'm aware that finalizers should be used only be used with unmanaged resources and…
I want to create a function for creating and initializing a controlled type (a bit like a factory) in the following manner:
function Create return Controlled_Type
is
Foo : Controlled_Type;
begin
Put_Line ("Check 1")
return Foo;
end…
Recently I found a serious problem that is in some cases finalization function does not work.
Description:
I defined a type, say TYPE(testtype):: T, in which many pointers and allocatable arrays being used. And there is a finalization subroutine,…
I am going through .net basics, and i am not able to understand why does .net need freachable queue why can't the finalization stuff happen in the finalization queue.
Any help to help me understand this would be deeply appreciated.
Thanks!
I have an application that can be extended using Python macros. As python is not often used, for every macro, I initialize the python interpreter, run the macro, and then finalize the interpreter.
Everything works just fine, with the exception of…
I always pair my initialization of a dynamic array with a finalizer in the form of
finally
SetLength(Array, 0);
end;
It feels more natural to know exactly when the array gets "destroyed" and allows me smoother transition from arrays to TList…
I am running a ISAPI service which runs with IdHTTPWebBrokerBridge (for debugging as standalone EXE) as well as in Apache with mod_isapi (in productive enviroment).
While logging some stuff at the destruction of the web module, I found following…
I have a library class used in ASP.Net and non-web applications that needs end-of-application finalization.
Within my project's library, I want the class to do its own end-of-application finalization without requiring a developer to add a call to…
I have many units with "finalization" sections in my Delphi 7 projects.
How do I make sure to execute some code last?
I tried to write a "finalization" section in the .dpr file but it does not compile.