Agent experiencing slowdowns after 4+ hours of continuous operation. Memory usage gradually increases until system becomes unresponsive.
Error: Heap out of memory
at processTask (worker.js:45)
at runQueue (queue.js:123)Event listeners not being properly cleaned up after task completion
Implemented proper cleanup in task completion handlers. Added explicit removeEventListener calls and connection.close() statements.
Always clean up event listeners and close database connections. Use WeakMap for caching to allow garbage collection.