Heap analyze on IBM i
Posted: Mon Jun 17, 2024 11:39 am
Hello,
I have to analyze a memory leak in our software running on IBM i. For that I use the following PEX commands:
Then I have some outfiles which can be joined together to get the heap address, allocated size and call stack:
My problem is, that the outfile QAYPEHEAP has only 5 fields to save 5 call stack entries. Is there a way to get more entries of the call stack?
How do you analyze memory (heap) leaks on IBM i?
On Windows we use WPA (Windows Performance Analyzer) for that.
Thanks and best regards,
Matthias
I have to analyze a memory leak in our software running on IBM i. For that I use the following PEX commands:
Code: Select all
ADDPEXDFN DFN(HEAP) TYPE(*TRACE) JOB((123456/MAT/MAT0 *ALL)) TASK(*ALL) MAXSTG(4000000) TRCTYPE(*SLTEVT) SLTEVT(*YES) MCHINST(*NONE) STGEVT((*ACTGRPHEAP))
STRPEX SSNID(HEAP)
- Do something in the job -
ENDPEX SSNID(HEAP) DTALIB(MATTRC) RPLDTA(*YES)
Code: Select all
CREATE VIEW mattrc/heapv1 AS
(SELECT a.QRECN,
a.QHPASA,
a.QHPASZ,
a.QHPOPR,
a.QHPRET,
-- c.QTITIMN,
(SELECT QPRPNM
FROM mattrc/QAYPEPROCI
WHERE QHPCK1 = QPRKEY) cs1,
QIASTMT1,
(SELECT QPRPNM
FROM mattrc/QAYPEPROCI
WHERE QHPCK2 = QPRKEY) cs2,
QIASTMT2,
(SELECT QPRPNM
FROM mattrc/QAYPEPROCI
WHERE QHPCK3 = QPRKEY) cs3,
QIASTMT3,
(SELECT QPRPNM
FROM mattrc/QAYPEPROCI
WHERE QHPCK4 = QPRKEY) cs4,
QIASTMT4,
(SELECT QPRPNM
FROM mattrc/QAYPEPROCI
WHERE QHPCK5 = QPRKEY) cs5,
QIASTMT5
FROM mattrc/QAYPEHEAP a
INNER JOIN mattrc/QAYPETIDX c
ON a.QRECN = c.QRECN
LEFT JOIN mattrc/QAYPEIAD d
ON a.QRECN = d.QRECN);
/* Check mallocs whithout free */
SELECT *
FROM mattrc/heapv1
WHERE QHPOPR = 0
AND QHPASA NOT IN(SELECT QHPASA FROM mattrc/heapv1
WHERE QHPOPR = 1);
How do you analyze memory (heap) leaks on IBM i?
On Windows we use WPA (Windows Performance Analyzer) for that.
Thanks and best regards,
Matthias