PIEHP0002 error resulting with memory requested but never freed

Document ID : KB000015159
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

If I am encountering a PIEHP0002 error, then the environment has some storage limitations.  This can be related to the job class definition or a problem with LE options or HEAP options which are being used.  What can I specifically do to resolve this?

Answer:

We recommend that you run with the following values for your //CEEOPTS DD statement for the LE options:

//CEEOPTS DD *
RPTOPTS(ON)
RPTSTG(ON)
ALL31(ON), STACK(,,ANYWHERE,KEEP,,), HEAP(,,,FREE,,)
/*

Here are the HEAP options for your reference which we have in effect, and we are not getting the PIEHP0002 error:

PARMLIB(CEEPRMS0) ANYHEAP(16384,8192,ANYWHERE,FREE)
PARMLIB(CEEPRMS0) BELOWHEAP(8192,4096,FREE)
DD:CEEOPTS HEAP(32768,32768,ANYWHERE,FREE,8192,4096)
PARMLIB(CEEPRMS0) HEAPCHK(OFF,1,0,0,0,1024,0,1024,0)
PARMLIB(CEEPRMS0) HEAPPOOLS(OFF,8,10,32,10,128,10,256,10,1024,10,2048,10,0,10,0,10,0,10,0,10,0,10,0,10)
IBM-supplied default HEAPZONES(0,ABEND,0,ABEND)
PARMLIB(CEEPRMS0) THREADHEAP(4096,4096,ANYWHERE,KEEP)

Please check if you are using a default for the HEAP() option .. which is HEAP(,,,KEEP,,).
This means that even if you call the free routine to release memory, it isn’t actually freed.
There are a variety of bugs that occur if the memory is really freed. So IBM recommends using the KEEP option to avoid these.