same code diferent output in different pcs with python 3.5
<p>I have this code:</p>

<pre><code>import gc

def hacerciclo():
    l=[0]
    l[0]=l

recolector=gc.collect()
print("Garbage collector %d" % recolector)
for i in range (10):
    hacerciclo()

recolector=gc.collect()
print("Garbage collector %d" % recolector)
</code></pre>

<p>This is an example code to the use of gc.collect(). The problem is that the same code shows different outputs in different computers.</p>

<p>One computers show:
Garbage collector 1
Garbage collector 10
others show:
Garbage collector 0
Garbage collector 10</p>

<p>Anyone knows why this happens? Thanks to everyone</p>

<blockquote>
  <p>The current version of Python uses reference counting to keep track of allocated memory. Each object in Python has a reference count which indicates how many objects are pointing to it. When this reference count reaches zero the object is freed. This works well for most programs. However, there is one fundamental flaw with reference counting and it is due to something called reference cycles. The simplest example of a reference cycle is one object that refers to itself. For example:</p>
</blockquote>

<pre><code>&gt;&gt;&gt; l = []
&gt;&gt;&gt; l.append(l)
&gt;&gt;&gt; del l
</code></pre>

<blockquote>
  <p>The reference count for the list created is now one. However, since it cannot not be reached from inside Python and cannot possibly be used again, it should be considered garbage. In the current version of Python, this list will never be freed.</p>
  
  <p>Creating reference cycles is usually not good programming practice and can almost always be avoided. However, sometimes it is difficult to avoid creating reference cycles and other times the programmer does not even realize it is happening. For long running programs such as servers this is especially troublesome. People do not want their servers to run out of memory because reference counting failed to free unreachable objects. For large programs it is difficult to find how reference cycles are being created.</p>
</blockquote>

<p>Source: <a href="http://arctrix.com/nas/python/gc/" rel="nofollow">http://arctrix.com/nas/python/gc/</a></p>

<p>The link below has the sample example you are using and it also explains:</p>

<p><a href="http://www.digi.com/wiki/developer/index.php/Python_Garbage_Collection" rel="nofollow">http://www.digi.com/wiki/developer/index.php/Python_Garbage_Collection</a></p>

python python-3.x