0

We are writing some real-time device controllers with embedded python.

We would like to control and predict (to some degree, not perfectly) what is being put on the Python Heap, to minimize and bound our garbage collections (which we will invoke manually). Our main work is done in "C". We want to use a restricted subset of Python to do data transform and other tasks.

What is a list of items that go on the heap? (or is it easier to list what goes only on the stack?)

  1. Lists
  2. Tuples
  3. (what about arrays of scalars such as int, float, etc)?
  4. What about an array of ustructs (structs pointing to C structs)?
Dr.YSG
  • 7,171
  • 22
  • 81
  • 139
  • 1
    Pretty much everything in Python goes on the heap. Python is not a good choice for real-time projects. – Colonel Thirty Two Nov 18 '16 at 15:03
  • I beg to differ, see what is happening with micro-Python: http://www.edn.com/electronics-blogs/embedded-basics/4440447/Using-Micro-Python-for-real-time-software-development – Dr.YSG Nov 18 '16 at 15:11
  • Technically speaking, "stack" and "heap" are properties of the implementation, not the language. My comment applies to the reference implementation at python.org, but your link mentions an alternate implementation called MicroPython. You'll need to investigate the MicroPython implementation; I suspect it doesn't support everything that the reference implementation does. – Colonel Thirty Two Nov 18 '16 at 15:17

0 Answers0