Problem With Calloc and MAlloc Functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anjanaanupindi
    New Member
    • Sep 2007
    • 6

    Problem With Calloc and MAlloc Functions

    #include<stdio. h>
    #include<ccblkf n.h>
    #include<cdefbf 533.h> //BF533 Register Pointer Definition
    #include<defbf5 33.h>



    section("sdram0 _data")
    float *p;

    void main()
    {


    p=(float*)callo c(1000,sizeof(f loat));
    if(p==NULL)
    {
    printf("Error allocating the Memory(1000)byt es\n");
    }
    else
    {
    printf("Memory( 1000)bytes allocated sucessfully\n") ;
    free(p);
    }

    p=(float*)callo c(2000,sizeof(f loat));
    if(p==NULL)
    {
    printf("Error allocating the Memory(2000)byt es\n");
    }
    else
    {
    printf("Memory( 2000)bytes allocated successfully\n" );
    free(p);
    }

    p=(float*)callo c(2001,sizeof(f loat));
    if(p==NULL)
    {

    printf("Error allocating the Memory(2001)byt es\n");
    }

    else
    {
    printf("Memory( 2001)bytes allocated successfully\n" );
    free(p);
    }



    p=(float*)callo c(14780,sizeof( float));//for integer its failing at this point//
    if(p==NULL)
    {
    printf("Error allocaing the Memory(14780)by tes\n");
    }
    else
    {
    printf("Memory( 14780)bytes allocated successfully\n" );
    free(p);
    }

    }

    }
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    So what is your problem,exactly ??

    Comment

    • anjanaanupindi
      New Member
      • Sep 2007
      • 6

      #3
      Originally posted by weaknessforcats
      So what is your problem,exactly ??
      Hello sir/madam

      . I am trying to use the calloc and the malloc functions. The calloc and malloc functions are able to allocate the memory upto size of 4K. After this calloc and malloc functions are unable to allocate the memory.
      It would be good if someone could provide a clue on to get this to work, so that we can allocate more than 4K of memory.


      Any help would be greatly appreciated.


      Thanks and Regards
      Pankaja

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Originally posted by anjanaanupindi
        The calloc and malloc functions are able to allocate the memory upto size of 4K. After this calloc and malloc functions are unable to allocate the memory.
        I have never heard that before and I have personally used calloc/malloc for allocation into the megabytes.

        Where are you getting this 4K limitation from???

        Comment

        Working...