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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.