Tinypy 1.1 GC Question

Skip to first unread message

Eric Rothfus

Nov 12, 2012, 5:29:28 PM11/12/12
to tin...@googlegroups.com
Apparently the group has been quiet for quite some time - hopefully people are still reading!

I'm using tinypy in a game where a simulated CPU runs multiple processes, each of which is a running tinypy VM.  Tinypy was well suited for this in particular because of it's step-by-step running of the python byte-code.  My modifications allow the simulated CPU to run n-steps of each VM in a round-robin approach, simulating running processes that are time-slicing the CPU.  I've extended the tinypy built-ins to include message passing routines, so the processes can communicate with each other.  And tinypy has been performing just great!

I'm getting quite familiar with v1.1, but have also recently downloaded the "cutting edge" code that includes a few fixes.  But what I don't quite understand in either version is the GC implementation, or frankly, philosophy.  I haven't spent much time in this area of the code (yet) because it seems to work.  Although I have replaced malloc/free calls with tracking routines that allow the simulated CPU to know how much memory each process is taking.

My question is, simply, when is garbage collection done?  I haven't actually seen garbage collection occurring until a VM is deinit()'d.  When it is deinit()'d all of the memory is freed, which is nice.  But is there a time during the run of the python byte-code that garbage collection (memory freeing) is done?

I've noted in the "cutting edge" download that the amount of memory is also being tracked in the "sandbox" which is doing pretty-much what my code did to monitor memory usage.

Phil Hassey

Nov 13, 2012, 11:14:12 AM11/13/12
to tin...@googlegroups.com
I'm a bit rusty on how it works, so I can't guarantee that my answers will be 100% accurate. 

The garbage collection is an incremental garbage collector.  So it only happens once in a while.  I think every time a list/dict is created, tinypy does a little bit of garbage collection.  


From: Eric Rothfus <er...@rothfus.com>
To: tin...@googlegroups.com
Sent: Monday, November 12, 2012 3:29 PM
Subject: [tinypy] Tinypy 1.1 GC Question

You received this message because you are subscribed to the Google Groups "tinypy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/tinypy/-/KKLcqKTzJSQJ.
To post to this group, send email to tin...@googlegroups.com.
To unsubscribe from this group, send email to tinypy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tinypy?hl=en.

Reply all
Reply to author
0 new messages