473,395 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem With Calloc and MAlloc Functions

#include<stdio.h>
#include<ccblkfn.h>
#include<cdefbf533.h> //BF533 Register Pointer Definition
#include<defbf533.h>



section("sdram0_data")
float *p;

void main()
{


p=(float*)calloc(1000,sizeof(float));
if(p==NULL)
{
printf("Error allocating the Memory(1000)bytes\n");
}
else
{
printf("Memory(1000)bytes allocated sucessfully\n");
free(p);
}

p=(float*)calloc(2000,sizeof(float));
if(p==NULL)
{
printf("Error allocating the Memory(2000)bytes\n");
}
else
{
printf("Memory(2000)bytes allocated successfully\n");
free(p);
}

p=(float*)calloc(2001,sizeof(float));
if(p==NULL)
{

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

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



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

}

}
Feb 12 '08 #1
3 2140
weaknessforcats
9,208 Expert Mod 8TB
So what is your problem,exactly??
Feb 12 '08 #2
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
Feb 14 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
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???
Feb 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

29
by: David Hill | last post by:
Is there a difference between: /* code 1 */ struct sample test; test = malloc(sizeof(struct sample)); memset(&test, 0, sizeof(test)); /* code 2 */ struct sample test; test = calloc(1,...
27
by: MK | last post by:
I am a newbie. Please help. The following warning is issued by gcc-3.2.2 compiler (pc Linux): ================================================================== read_raw_data.c:51: warning:...
37
by: Harsimran | last post by:
Can any one explain what are far pointers and what is the difference between malloc and calloc .Which is better ?
7
by: Excluded_Middle | last post by:
Suppose I have a struct typdef struct foo { int age; char *name; }foo; now I made a list of foo using
7
by: mef526 | last post by:
I have had this problem for months now and it has been nagging me. I have a large project that has several C++ DLL's, one of them uses malloc / calloc / free for the other DLL's. I process very...
8
by: venkatesh | last post by:
hai to everybody, i am having doubt in difference between the malloc and calloc function. please tell where to use and when to use those functions?
14
by: Roka100 | last post by:
Hi all, I tried 2 programs : #include <stdio.h> #include <string.h> 1, int main(void){ char *str = NULL;
7
by: ds | last post by:
Hello all, I have a problem with calloc I have never seen before. I am migrating some C code to C++ and at some part in the C code there is a calloc that creates an array of structures. Now in...
6
by: mthread | last post by:
Hi, I am learning C++ and I have been told that an object can be created either by using calloc or new. If it is true, can some one tell me what is the difference b/w using these two function...
13
by: manish sahu | last post by:
difference between calloc() and malloc()
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.