I am trying to create a large buffer in my heap by using calloc. However, if the size of the calloc size parameter exceeds 0xFFFF the function returns a null pointer. I have set the heap to 0x12000 words (0x24000 bytes) in my linker file. I can verify that the heap is properly allocated by looking at the map file. But calloc refuses to allocate more than 0xFFFF words of memory. I am using a large memory model.
Below is my code. Can anyone offer a suggestion?
void mem_test()
{
size = 0x10000; //this size returns a null pointer....
minit();
char_size = sizeof(unsigned char);
buffer = (unsigned char*) calloc (size, char_size );
memset(buffer, 0x55, size);
}