summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-01-15 10:30:33 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-01-16 23:04:53 +0100
commit915cc86f5d022e2a2eb3bbe03e3e3ec1c9e3e60a (patch)
tree06a4677de0f851a88a87b07076856e8d51c59b0a /doc
parent704eae84951df114f5aa9cc40fdecb2ad788ea16 (diff)
downloadNim-915cc86f5d022e2a2eb3bbe03e3e3ec1c9e3e60a.tar.gz
docs for the heap dump feature
Diffstat (limited to 'doc')
-rw-r--r--doc/gc.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/gc.rst b/doc/gc.rst
index bb0088617..7ec4e6d36 100644
--- a/doc/gc.rst
+++ b/doc/gc.rst
@@ -127,3 +127,20 @@ In addition to ``GC_ref`` and ``GC_unref`` you can avoid the GC by manually
 allocating memory with procs like ``alloc``, ``allocShared``, or
 ``allocCStringArray``. The GC won't try to free them, you need to call their
 respective *dealloc* pairs when you are done with them or they will leak.
+
+
+Heap dump
+=========
+
+The heap dump feature is still in its infancy, but it already proved
+useful for us, so it might be useful for you. To get a heap dump, compile
+with ``-d:nimTypeNames`` and call ``dumpNumberOfInstances`` at a strategic place in your program.
+This produces a list of used types in your program and for every type
+the total amount of object instances for this type as well as the total
+amount of bytes these instances take up. This list is currently unsorted!
+You need to use external shell script hacking to sort it.
+
+The numbers count the number of objects in all GC heaps, they refer to
+all running threads, not only to the current thread. (The current thread
+would be the thread that calls ``dumpNumberOfInstances``.) This might
+change in later versions.