dumpHeapSample
Syntax
dumpHeapSample(filename)
Details
This function generates a snapshot of the current heap memory. It records the current memory usage, including allocated memory blocks, their sizes, and states. Only administrators can execute this function.
Arguments
filename is a string representing the path for the heap memory snapshot file.
Examples
Recommended workflow for memory usage analysis:
- Enable heap memory sampling: This can be done by setting the environment
variable TCMALLOC_SAMPLE_PARAMETER to a value between 1 and 524288 (recommended:
524288) before starting DolphinDB; or by dynamically enabling it using
startHeapSample
. - Execute
dumpHeapSample
before and after operations that may cause memory leaks, saving to two different files. Compare these files to confirm memory allocation and usage related to the operation. - Disable heap memory sampling.
startHeapSample(524288)
dumpHeapSample("/DolphinDB/Data/heap1")
dumpHeapSample("/DolphinDB/Data/heap2")
stopHeapSample()
Related functions: startHeapSample, stopHeapSample