Hello,
I am working with C5515 eZDSP USB Stick. Heap size is: -heap 0x14000 /* HEAP AREA SIZE */
** With this code:
void main(void) { short *a; a = (short*) malloc(sizeof(short) * 70000); printf("Address A: "); printf("%p\n", a); free(a); }
malloc run well and return the first address of the allocated array.
** But with this code:
void main(void) {
short *a;
a = (short*) malloc(sizeof(short) * 50000);
printf("Address A: ");
printf("%p\n", a);
free(a);
}
a is a null pointer 0x00000000
** And with this code:
void main(void) { short *a, *b; a = (short*) malloc(sizeof(short) * 32000); b = (short*) malloc(sizeof(short) * 32000); printf("Address A: "); printf("%p\n", a); printf("Address B: "); printf("%p\n", b); free(a); free(b); }
'a' is the address of the allocated memory, but 'b' is null pointer 0x00000000
I tested with large and huge memory model for these code, same problem happened.
Please explain and help me to solve this problem, thanks.