Thread: Regarding the maximum memory allocated by malloc() function on HP-UX B11.11

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    1

    Regarding the maximum memory allocated by malloc() function on HP-UX B11.11

    In a 'C' program,when I am trying to allocate memory with the help of malloc () function, it is allocating the memory up to a certain limit for e.g. in my case, it is 670 MB (approx). malloc() returns NULL if I allocate more than this amount of memory.When I tried
    to allocate memory in chunks of 200MB, it failed when I exceed 670 MB.While I have sufficient amount of memory available (78 GB).

    Actually I am getting CDRs from mediation for each subscriber and I have to allocate memory for each subscriber. There is a routine written inside the code where there is a structure containing Customer’s id, contract id, cell number, Activation Date and Deactivation Date in memory. So to avoid this issue, I hardcoded the value of one member of the structure.But this is not a permanent solution. So please help me to figure out how to increase the amount of memory allocated by malloc().Your valuable feedback appreciated.

    os is 64 bit.
    getconf KERNEL_BITS ==>> 64

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    IT doesn't matter how much disk space you have, what matters is how much of that space can be used as virtual memory(I believe it's called swap space on *nix systems). Yours is probably no more than 670 MB.
    Last edited by claudiu; 06-25-2010 at 03:50 AM.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Why do you need 700MB+ for each subscriber?

    Perhaps restructuring the code so that it deals with data via a cache or a stream would be useful.

    Perhaps you have a low 'ulimit'
    ulimit MAN Page
    Regardless of your physical memory, maybe your admin has restricted the upper limit of what your processes are allowed to use.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  3. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  4. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM

Tags for this Thread