Henning Thielemann wrote:
> I have added some debug output to the wrapper
>
> PROCEDURE CleanupPlan (<* UNUSED *> READONLY w: WeakRef.T; r: REFANY) =
> BEGIN
> IO.Put("Cleanup_Plan\n");
> FFTWLongRealRaw.DestroyPlan(NARROW(r, Plan)^);
> END CleanupPlan;
>
> that I use as a cleanup procedure for a WeakRef:
>
> ...
> plan^ := FFTWLongRealRaw.PlanDFT1D(n, in[0], out[0],
dirToSign[sign],
> LOOPHOLE(flags, C.unsigned_int));
> EVAL WeakRef.FromRef(plan, CleanupPlan);
> RETURN plan;
> ...
>
> Suprisingly the "Cleanup_Plan" won't be printed in most cases. I use
only
> short test programs that some computations and then quit immediately.
Does
> the result mean that the wrapper wasn't called or does it mean that the
> output of the text failed?
The CleanupPlan procedure will be executed when the garbage collector
detects that `plan' is no more reachable. Perhaps a call to
RTCollector.Collect() with the specified semantics of
`Maybe collect now' :-) will improve the behaviour.
Olaf


|