Kotlin Worker Pool - Long Running Kotlin Coroutine and Java Heap OutOfMemory
I'm trying to replicate a Worker Pool in Kotlin: https://gobyexample.com/worker-pools
It works wonderful, but my problem is that I get OutOfMemoryError because all object references from the worker coroutines are kept in the heap as long as the coroutine is running. How can I avoid this problem?
Here is my code:
I create a channel in Service A and receive the data everytime a channel object is received.
class...