Home Forums C Programming Memory allocation overflow in c program

Viewing 0 reply threads
  • Author
    Posts
    • #2199
      Carmelo38I
      Participant

      In a large system I try to allocate about 1GB of memory on a 4GB system

      and it blows up (returns a NULL pointer in C), Now I tried to allocate

      1GB from a small test program and it also returns null.

      Also, I have implemented the /LARGEADDRESSLIMIT switch on the Linker,

      to be able to address more than 2GB RAM. But the system does not want

      to allocate 1GB, when the available memory is 1.8GB according to the

      Task Manager!!

      ex: BYTE *bb=(BYTE*) calloc(0.9, 0x40000000);
      where BYTE is unsigned char

      I can only allocate about 400MB, otherwise I get NULL

      How much memory I can allocate from a C program ?

      It looks like there is something I don’t quite understand about the x86

      memory model.

Viewing 0 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.