> Is there any reason why the memory usage is so much higher if we generate
a
> new Transformer each time? Its about twice as much vs. reusing the same
> Transformer.

Are you sure real memory use is higher, as opposed to transient? I'd expect
that garbage collection could take a little while to clear out the old
objects, which could be misleading you.

Outside of that, I can't think of anything offhand which would cause a
significant memory blip. Might be a good idea to review a testcase... I
don't have cycles right now to do so, unfortunately.


Just did a quick re-check, and the docs for Tranformers say:

"An object of this class may not be used in multiple threads running
concurrently. Different Transformers may be used concurrently by different
threads."


but they also say


"A Transformer may be used multiple times. Parameters and output properties
are preserved across transformations."


I'd actually forgotten the latter... So if you want to avoid manufacturing
a new Transformer every time you can do so ... but it's your responsibility
to ensure that any Transformer is never accessed by more than one thread at
a time.

Reply via email to