Skip to content

Instantly share code, notes, and snippets.

@matburt
Last active December 16, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matburt/446b832f2bc939b50c6180c4b98785fd to your computer and use it in GitHub Desktop.
Save matburt/446b832f2bc939b50c6180c4b98785fd to your computer and use it in GitHub Desktop.
valgrind on python's deepcopy
$ valgrind --tool=massif python -c "from copy import deepcopy; deepcopy(dict(foo='bar'))"
==1322== Massif, a heap profiler
==1322== Copyright (C) 2003-2015, and GNU GPL'd, by Nicholas Nethercote
==1322== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==1322== Command: python -c from\ copy\ import\ deepcopy;\ deepcopy(dict(foo='bar'))
==1322==
==1322==
$ ms_print massif.out.1319 > ms.1319
--------------------------------------------------------------------------------
Command: python -c from copy import deepcopy; deepcopy(dict(foo='bar'))
Massif arguments: (none)
ms_print arguments: massif.out.1319
--------------------------------------------------------------------------------
MB
2.074^ :::::
| @@:@#: :
| @ @@@@:@#: :
| :: :@@:@@@@:@#: :
| @::::::@@:@@@@:@#: ::
| @@@@::::::@@:@@@@:@#: :::
| @@@@@@::::::@@:@@@@:@#: :::
| @@@@@@@@@::::::@@:@@@@:@#: ::::
| :::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| @:::::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| @@@:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| @:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| @:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| :@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| :@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| :::@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| :::::@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| :@:::::@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| @@:@:::::@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
| ::@@:@:::::@:@:::@@ @:: ::::@::::@ @@@@@@@::::::@@:@@@@:@#: :::::
0 +----------------------------------------------------------------------->Mi
0 25.50
Number of snapshots: 74
Detailed snapshots: [4, 5, 7, 13, 15, 19, 20, 21, 28, 33, 34, 35, 36, 37, 38, 39, 40, 47, 48, 51, 52, 53, 56, 58, 61, 63, 64 (peak)]
[...]
| ->03.82% (28,032B) 0x4EB0C4A: PyDict_Merge (in /usr/lib64/libpython2.7.so.1.0)
| | ->03.82% (28,032B) 0x4EB0E16: PyDict_Copy (in /usr/lib64/libpython2.7.so.1.0)
| | ->03.82% (28,032B) 0x4F239EC: _PyImport_FixupExtension (in /usr/lib64/libpython2.7.so.1.0)
| | ->02.15% (15,744B) in 4 places, all below massif's threshold (1.00%)
| | |
| | ->01.68% (12,288B) 0x4F3003D: Py_InitializeEx (in /usr/lib64/libpython2.7.so.1.0)
| | ->01.68% (12,288B) 0x4F4034D: Py_Main (in /usr/lib64/libpython2.7.so.1.0)
| | ->01.68% (12,288B) 0x5B3FC03: (below main) (in /usr/lib64/libc-2.17.so)
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment