Add example about how to dump heap
MODIFY
docs/en/advanced-concepts/memory-collection.md
docs/en/advanced-concepts/memory-collection.md
@@ -22,6 +22,28 @@ Dump files are created in the same folder where the main Appium script has been
They have the `.heapsnapshot` extension, and can be loaded into the Chrome Inspector for further investigation.
+#### Examples
+```shell
+# 1. Go to the directory where appium is installed via NPM using one of the two cd command below, depending on appium
+# is installed globally or locally
+## if your appium is globally installed via NPM with command "npm install -g appium":
+cd "$(npm -g root)/appium/"
+## else if your appium is locally installed via NPM:
+cd "$(npm root)/appium/"
+
+# 2. Start appium server with heapsnapshot signal
+# "&" at the end puts the process at background, so we can continue working on the same terminal
+node --heapsnapshot-signal=SIGUSR2 . &
+
+# 3. Get the PID of previous node process
+pid=$!
+
+# 4. When it's time to dump the heap, issue a SIGUSR2 signal to the PID got above
+kill -SIGUSR2 $pid
+# Then the heap dump file is created in current directory
+```
+
+
### Dump file analysis
Read the [Rising Stack article](https://blog.risingstack.com/finding-a-memory-leak-in-node-js/) for more details.

Add example about how to dump heap (#14694)