• 2 replies
  • Latest Post - ‏2014-06-23T16:51:55Z by scott_klement
115 Posts

Pinned topic Problems mixing malloc and %ALLOC

‏2014-06-23T07:46:11Z |


we have an application which works heavily with pointer, storage allocation etc.

Since year we are searching for a pointer error, which results from an error logged within the joblog (MCH0601):

Space offset x'00000000' or x'0000800155C875D0 is outside the current limit for object DIRWEB    QTMHHTTP 418670.
... the space class is 07.

In most of the places (RPG and C) storage is allocated with the c-function malloc, but in a few procedures the RPG built-in-function %ALLOC is used. It seams the problem occurs under some conditions as soon as the RPG built-in-function %ALLOC is executed. (Storage is calculated correctly and the RPG-built-in-function does not crash either!)

Someone else has any experiences with allocating storage with malloc and %ALLOC within the same application?

Or any other idea?


  • EmmanuelW
    5 Posts

    Re: Problems mixing malloc and %ALLOC


    I haven't used either of these op-codes very much, but the first hit on Google for that error:

    ...contains this rather unusual statement:

    "If the from and to programs are system programs, there might be a software bug."



  • scott_klement
    275 Posts

    Re: Problems mixing malloc and %ALLOC


    MCH0601 means that a pointer was set to an offset that's outside of an allocation.

    In other words, if you allocate 1024 bytes, and then set the pointer to the start address + 1500, you may get an MCH0601, since you can't offset to position 1500 if your space is only 1024 bytes long.

    So, if you get this error, it would not occur on a malloc or %alloc call.  It would occur when adding to a pointer.