Memory allocation overflow in c program

Home Forums C Programming Memory allocation overflow in c program

This topic contains 0 replies, has 1 voice, and was last updated by  Carmelo38I 8 years, 8 months ago.

  • Author
    Posts
  • #2199

    Carmelo38I
    Member

    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.

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble