Is the memory shared between the StringIO if I do that? I have the feeling it is because the memory of the python process did not increase on line 6.
In [1]: from StringIO import StringIO
In [2]: s = StringIO()
In [3]: s.write('abcd'*10000000) # memory increases
In [4]: s.tell()
Out[4]: 40000000
In [5]: s.seek(0)
In [6]: a = StringIO(s.read()) # memory DOES NOT increase
In [7]: a.tell()
Out[7]: 0
In [8]: a.read(10)
Out[8]: 'abcdabcdab'
However my concern is that when I delete those 2 variables, the memory consumption of the python process does not decrease anymore... why ? Does this code create a memory leak ?
When I just used one variable, the memory is well freed when I delete the variable.
I'd be curious to better understand what is going on here. Thanks.