Results 1 to 3 of 3

Thread: malloc()

  1. #1

    Thread Starter
    Junior Member xtci's Avatar
    Join Date
    Feb 2003
    Posts
    22

    malloc()

    how can i allocate more ram then i have?

    char *str;

    if ( ( str = (char *) malloc(100000000) ) == NULL)
    {
    printf( "Not enough memory to allocate buffer\n");
    exit(1);
    }
    printf( "String was allocated!\n" );


    100000000b/1024b*2=95Mb >> Sting allocated!!
    but i have only 64Mb

    virtual memeory??

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Yes.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Under Windows, you should be able to use VirtualAlloc
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width