C/C++

C/C++

C/C++

Your one-stop destination to learn and collaborate about the latest innovations in IBM C/C++ for z/OS compilers to develop high-performing C/C++ applications and system programs on z/OS while maximizing hardware use and improving application performance.

 View Only

malloc fails beyond 125MB in a C program

  • 1.  malloc fails beyond 125MB in a C program

    Posted Thu February 09, 2023 09:44 AM

    Hi,

    This is a very basic question. I wrote a basic C program that malloc()s an array and accesses elements from it. And then free()s all the elements.

    However, malloc() call fails if the allocation request is over 125MB.

    I have set "unlimited" to all the parameters related to memory allocation (e.g., stack size, heap size) under the "ulimit" command. But it does not solve the problem.

    I'm running the C program on a Power9 VM. The same program runs absolutely fine on a Linux-based system.

    If somebody could help me with this, that'll be great. Thanks.



    ------------------------------
    Muhammad Laghari
    ------------------------------