Note 2620830 - How to Record SAP HANA Memory Allocator Traces to Analyze Memory Leaks
Note 2620830 - How to Record SAP HANA Memory Allocator Traces to Analyze Memory Leaks
2620830 - How To Record SAP HANA Memory Allocator Traces to Analyze Memory
Leaks
Component: HAN-DB (SAP HANA > SAP HANA Database), Version: 4, Released On: 14.05.2019
Symptom
You observe one or multiple of below situations:
1. You observe that the overall memory consumption slowly increases on the system even though there was no obvious
change to the load in the system.
You can see that a certain allocator is occupying a big amount of memory, e.g. using below query:
and there is no obvious culprit or query that it can be tracked back to.
2. You observe that the system is constantly running out of memory, even under a normal load.
The out of memory dump contains a section listing the top allocators ordered by exclusive_size_in_use, following below
pattern:
Below is an example which demonstrates that allocator 1 dominates memory consumption as it is much larger than all
others:
By checking the statistics for this allocator in _SYS_STATISTICS.HOST_HEAP_ALLOCATOR, you see that the allocator
seems to be increasing consistently over time without ever decreasing.
3. You observe that after executing a certain query, the memory consumption on the system increases by a certain amount,
and it does not decrease after a certain amount of time.
You suspect a leakage for a certain allocator by monitoring the allocator sizes in M_HEAP_MEMORY before/after
executing the query, e.g. using query:
2. Reset possible existing trace entries. Please replace the allocator with the complete name including the hierarchy, e.g.
the full string returned as CATEGORY from M_HEAP_MEMORY
4. Create initial Allocator Trace report, and write down the current size of the allocator. In case the SQL does not return
any record, it means that there is currently no allocation on this allocator.
5. In case there is a suspected query/application transaction, execute it to reproduce. Otherwise, wait and monitor the size
of the allocation, until you see a noticeable growth compared to the starting point.
Save the result of the current allocation size, create a report of Allocator Trace and generate a callgraph.
Note, it is the best to check the allocator size and collect the report when there is no load (or relatively
low) on the system if possible. Only in that case, we can make sure that the stacks recorded in allocator trace are
pointing to the leakage, instead of meaningful allocations for the active queries.
6. Repeat step 5. and create 3-5 reports & callgraphs with the allocation size returned from the SQL.
7. Disable astrace
8. Cleanup
9. Zip the allocator size returned by SQL, Allocator Trace reports and callgraphs generated in step 4 and 5 and contact SAP
Support for root cause analysis.
Software Components
Software Component From To
2601475 HAN-DB- Memory Leak in Pool/malloc/libhdbcsapi.so When Running Enterprise Search Queries
ENG
2410143 HAN-DB Using hdbcons Commands in MDC Environment With High Isolation Level
2405237
2398507 HAN-DB Memory in Pool/ICT is Constantly Increasing and Does not get Released
2368929 HAN-DB Memory Leak in Pool/RowEngine/RSTempPage when Row Store Temp Tables without Variable
Length Columns are Used
2362759 HAN-DB- Row table memory leak on SPS11 (Rev111~112.05) and SPS12 (Rev120~122.01)
ENG
2312948 HAN-DB Memory leak in Pool/SQLScript/Execution when a procedures is called via XS engine
2275252 HAN-DB Memory Leak in "Pool/malloc/libhdbrskernel.so" When SqlScript Procedures or UDFs Get Compiled
2271235 HAN-DB Memory Leak in Pool/RowEngine/QueryExecution when Using Batch Inserts on Row Store tables
2253121 HAN-DB Memory Leak in Pool Pool/malloc/libhdbrskernel.so when Using Batch Inserts Into Rowstore Tables
2088349 HAN-DB memory leak when querying calculation views which are executed in
2000792 HAN-DB SAP HANA: High Memory Consumption and constantly growing on Pool/RowEngine/QueryExecution