Macaulay2 Engine
Loading...
Searching...
No Matches
finalize.hpp File Reference

intern_* helpers that register long-lived engine objects with bdwgc finalisers. More...

Go to the source code of this file.

Functions

void intern_polyring (const PolynomialRing *G)
void intern_monideal (MonomialIdeal *G)
MutableMatrixinternMutableMatrix (MutableMatrix *G)
void intern_GB (GBComputation *G)
void intern_res (ResolutionComputation *G)
void intern_SchreyerOrder (SchreyerOrder *G)

Detailed Description

intern_* helpers that register long-lived engine objects with bdwgc finalisers.

Note
AI-generated documentation. Verify against the source before relying on it.

Declares intern_polyring, intern_monideal, internMutableMatrix, intern_GB, intern_res, and intern_SchreyerOrder. Each one takes a freshly constructed engine object that will outlive its caller (typically because it is being returned to the interpreter) and registers it with bdwgc via GC_REGISTER_FINALIZER (or _IGNORE_SELF) pointing at a per-type remove_* trampoline that runs the C++ destructor when the collector decides the object is unreachable. Without this step bdwgc would reclaim the bytes but skip the destructor, leaking any resource the type holds outside the GC heap.

Objects owned by stack-based holders that delete explicitly do not need to be interned; the in-source comment is precise about "if G will not be freed by its owner." internMutableMatrix is the one helper that also returns the registered pointer, supporting the return internMutableMatrix(new MutableMatrix(...)) idiom common at engine factory entry points.

See also
newdelete.hpp

Definition in file finalize.hpp.