There seems to be a memory leak when creating engines or compiling templates.
The culprit seems to be the object finalizer: the creation of the lambda in the context of the instance is causing the Ruby VM to hold on to the engine's object.
From the documentation:
The two recommended patterns are to either create the finaliser proc in a non-instance method where it can safely capture the needed state, or to use a custom callable object that stores the needed state explicitly as instance variables.
There seems to be a memory leak when creating engines or compiling templates.
The culprit seems to be the object finalizer: the creation of the lambda in the context of the instance is causing the Ruby VM to hold on to the engine's object.
From the documentation: