Potential Memory Leak: EntityListIterator and AutoCloseable Implementation


I’ve noticed that the EntityListIterator class currently does not implement the AutoCloseable interface. This absence might be contributing to improper resource management and, consequently, the observed memory leak. To enhance the situation, I propose that we implement the AutoCloseable interface for EntityListIterator and encourage the use of the try-with-resources statement when initializing the iterator.

Anyone else has faced a similar memory leak issue related to the EntityListIterator ?

Thanks & Regards

Deepak Dixit

1 Like

Not a bad idea, and simple to add, see moqui-framework commit d82db61e.

1 Like

Thanks David.

I’ll create pull request to update the ELI code references, ensuring the use of try-with-resources for improved resource management.

1 Like