malloc crashes for values >3500

Martin Osterloh martin.osterloh@dartmouth.edu
Wed Jan 2 22:30:00 GMT 2013


Hi all,

I have a working newlib port for my x86_64 OS. I can do malloc() without 
any problems if the size of the memory I request is less than ~3500. I 
have enough memory available - far more than 3500.

I am just wondering if anyone of you guys had a hint? My sbrk 
implementation is the one that gets shipped with newib:

char * sbrk(int nbytes);
{
   char        *base;

   if (!heap_ptr)
     heap_ptr = (char *)&_end;
   base = heap_ptr;
   heap_ptr += nbytes;

   return base;
}

My page size is 4096. One thought that comes to my mind is that I reach 
the end of a page and I fail to allocate a new page?

I am keen to hear your opinions.

Thanks,
--Martin



More information about the Newlib mailing list