1

Using Python's 3.5 tracemalloc module as follows

tracemalloc.start(25)  # (I also tried PYTHONTRACEMALLOC=25)
snapshot_start = tracemalloc.take_snapshot()
...  # my code is running
snapshot_stop = tracemalloc.take_snapshot()
diff = snapshot_stop.compare_to(snapshot_start, 'lineno')
tracemalloc.stop()

leads in a list of StatisticDiff instances where each instance has a traceback with only 1 (the most recent) frame.

Any hints how to get there the full stack trace for each StatisticDiff instance?

Thank you! Michael

1 Answers1

1

You need to use 'traceback' instead of 'lineno' when calling compare_to() to get more than one line.

BTW, I also answered a similar question here with a little more detail.