Please sign in to comment.
Introduce M.A.D. within the schema/source instance linkage
When a source instance is registered with a schema instance, the code in Schema::_register_source() adds a strong ref of the source to the schema register, and a weak schema ref to the source itself. Install DESTROY handlers both on Schema and ResultSource to flip this setup any time the Schema instance goes out of scope (if we somehow increment the refcount of $self in a DESTROY, then the garbage collection is aborted). Tested all the way back to 5.8.1 with excellent results. Promote the source links in both ResultSet and Row to real ResultSource instance refs, as there's no longer any issue with memory leaks (before a source handle would be instantiated lazily to sidestep the source object entirely by keeping a schema ref instead). Add freeze/thaw hooks for proper serialization of Source-containing structures (be it Row's or ResultSet's). In another round of cleanup ResultSourceHandle will be reduced to purely a "no schema yet" placeholder after schema-less a freeze/thaw cycle.
- Loading branch information...
Showing with 154 additions and 70 deletions.