Update 30-how-to-profiling.md
add new section "memory profiling"
@@ -32,3 +32,53 @@ Or
```shell
go tool pprof -http=0.0.0.0:8081 $HOME/pprof/pprof.cpu.007.pb.gz
```
+
+## memory profiling
+
+- Build `databend-query` with memory-profiling feature enabled
+
+ under the project root path:
+
+ `~/workspace/fuse-query$ cargo build --features memory-profiling`
+
+- Fire up `databend`, with proper `MALLOC_CONF` setting
+
+ for example `MALLOC_CONF=prof:true ./target/debug/databend-query`
+
+- Dump memory prof
+
+ NOTE: currently, periodical heap prof dump is NOT supported. A "snaphost" of the heap prof is dump instead.
+
+ - by using `jeprof`
+
+ ```shell
+ ~/workspace/fuse-query$ jeprof ./target/debug/databend-query http://localhost:8080/debug/mem
+ Using local file ./target/debug/databend-query.
+ Gathering CPU profile from http://localhost:8080/debug/mem/pprof/profile?seconds=30 for 30 seconds to ~/jeprof/databend-query.1650949265.localhost
+ Be patient...
+ Wrote profile to /home/zhaobr/jeprof/databend-query.1650949265.localhost
+ Welcome to jeprof! For help, type 'help'.
+ (jeprof) top
+ Total: 16.2 MB
+ 10.2 62.7% 62.7% 10.2 62.7% ::alloc
+ 6.0 37.3% 100.0% 6.0 37.3% ::alloc_zeroed
+ 0.0 0.0% 100.0% 10.2 62.7% ::allocate
+ 0.0 0.0% 100.0% 0.5 3.3% ::call
+ 0.0 0.0% 100.0% 4.0 24.7% ::default
+ 0.0 0.0% 100.0% 1.2 7.2% ::deref
+ 0.0 0.0% 100.0% 1.2 7.2% ::deref::__stability (inline)
+ 0.0 0.0% 100.0% 1.2 7.2% ::deref::__static_ref_initialize (inline)
+ 0.0 0.0% 100.0% 0.5 3.1% ::from
+ 0.0 0.0% 100.0% 9.2 56.6% ::from_iter
+ (jeprof)
+ ```
+ - or curl
+ ```shell
+ ~/workspace/fuse-query$ curl -O -J http://localhost:8080/debug/mem/pprof/profile
+ % Total % Received % Xferd Average Speed Time Time Time Current
+ Dload Upload Total Spent Left Speed
+ 100 22733 100 22733 0 0 21.6M 0 --:--:-- --:--:-- --:--:-- 21.6M
+ curl: Saved to filename 'heap_dump_NIKcRe.prof'
+ ```
+
+
