Hi,
I'm using rxpy for an event-driven application and after some stress tests I noticed a strange behaviour on memory usage.
I've created a simple script to reproduce the issue.
from rx.scheduler import ThreadPoolScheduler
from rx.subject import Subject
import rx.operators as ops
from threading import current_thread
import multiprocessing
import rx
import time
pool_scheduler = ThreadPoolScheduler(multiprocessing.cpu_count())
pipeline = [ops.map(lambda x: x**2)]
pipeline.append(ops.observe_on(pool_scheduler))
s = Subject()
s.pipe(*pipeline).subscribe(on_next=lambda x: print("{}, thread: {}".format(x, current_thread().name)))
for i in range(100000000000):
s.on_next(i)
input()
I'm using memory-profile library for tracing the memory usage of this script, after 30 seconds of run the result is the following:

The memory is growing linearly.
If I place a time.sleep(0.1) inside the for loop the memory usage is steady.
from rx.scheduler import ThreadPoolScheduler
from rx.subject import Subject
import rx.operators as ops
from threading import current_thread
import multiprocessing
import rx
import time
pool_scheduler = ThreadPoolScheduler(multiprocessing.cpu_count())
pipeline = [ops.map(lambda x: x**2)]
pipeline.append(ops.observe_on(pool_scheduler))
s = Subject()
s.pipe(*pipeline).subscribe(on_next=lambda x: print("{}, thread: {}".format(x, current_thread().name)))
for i in range(100000000000):
s.on_next(i)
time.sleep(0.1)
input()

I don't know if the problem is related to python / rxpy or if I'm using the library in a wrong way.
PS: the memory usage is steady if I get rid of scheduler and everything is executed on the main thread.
Hi,
I'm using rxpy for an event-driven application and after some stress tests I noticed a strange behaviour on memory usage.
I've created a simple script to reproduce the issue.
I'm using memory-profile library for tracing the memory usage of this script, after 30 seconds of run the result is the following:
The memory is growing linearly.
If I place a time.sleep(0.1) inside the for loop the memory usage is steady.
I don't know if the problem is related to python / rxpy or if I'm using the library in a wrong way.
PS: the memory usage is steady if I get rid of scheduler and everything is executed on the main thread.