Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualLode

Posted 25 April 2013 - 04:48 AM

Hello,

 

In C, users of a library or sometimes not happy when malloc, realloc and free are used to allocate the output.

 

In C++, the same applies I guess (needing custom allocators for the STL).

 

I'm basically wondering why?

 

If for mobile development or other small devices, doesn't the compiler for those devices use a proper malloc/realloc/free for that device?

 

If for a memory pool: why is it useful to also use your memory pool for the allocations another library you're using is doing?

 

Apart from tiny devices and memory pools, are there other possible reasons I missed why you'd want something else than malloc, on a desktop computer? If so, which reasons are this?

Knowing why will make me take these usages into account better when designing an API.

 

Thanks!


#1Lode

Posted 25 April 2013 - 04:48 AM

Hello,

 

In C, users of a library or sometimes not happy when malloc, realloc and free are used to allocate the output.

 

In C++, the same applies I gues (needing custom allocators for the STL).

 

I'm basically wondering why?

 

If for mobile development or other small devices, doesn't the compiler for those devices use a proper malloc/realloc/free for that device?

 

If for a memory pool: why is it useful to also use your memory pool for the allocations another library you're using is doing?

 

Apart from tiny devices and memory pools, are there other possible reasons I missed why you'd want something else than malloc, on a desktop computer? If so, which reasons are this?

Knowing why will make me take these usages into account better when designing an API.

 

Thanks!


PARTNERS