Search code examples
assemblymemoryzosmvs

How can I obtain memory usage information using zos assembler


How can I programmatically obtain the amount of memory an assembler program is currently using assembler instructions/macros from within the running program? I'm debugging an 878 (out of memory) error, and I"d like my program to report at different stages how much memory it is using.


Solution

  • Region size can be set a variety of different ways depending on the type of address space (TSO session, batch job, STC, ...). Some sites set custom region sizes using an SMF exit, so it's not always easy to understand what's going on here.

    The limit value for a given address space is stored in the LDA data area (see https://www-304.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3ga320937/$file/iead300_v2r3.pdf). In an assembler program, you'd get this value by following PSAAOLD to ASCBLDA and then examining whatever region size you're looking for.

    A more modern interface to this stuff is available in the various UNIX Services APIs on z/OS. For example, getrusage (BPX1GRU) gives you your resource utilization for several resources, including memory. All an assembler program needs to use this stuff is a UNIX UID value in your security information - no other special setup is needed.