Ignore:
Timestamp:
Feb 23, 2022, 10:31:12 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
cc7bbe6
Parents:
f53afafb
Message:

more updates to added text

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mubeen_zulfiqar_MMath/allocator.tex

    rf53afafb r3a038fa  
    118118We added a few more features and routines to the allocator's C interface that can make the allocator more usable to the programmers. THese features will programmer more control on the dynamic memory allocation.
    119119
     120\subsection{Out of Memory}
     121
     122Most allocators use @nullptr@ to indicate an allocation failure, specifically out of memory;
     123hence the need to return an alternate value for a zero-sized allocation.
     124The alternative is to abort a program when out of memory.
     125In theory, notifying the programmer allows recovery;
     126in practice, it is almost impossible to gracefully when out of memory, so the cheaper approach of returning @nullptr@ for a zero-sized allocation is chosen.
     127
     128
    120129\subsection{\lstinline{void * aalloc( size_t dim, size_t elemSize )}}
    121130@aalloc@ is an extension of malloc. It allows programmer to allocate a dynamic array of objects without calculating the total size of array explicitly. The only alternate of this routine in the other allocators is calloc but calloc also fills the dynamic memory with 0 which makes it slower for a programmer who only wants to dynamically allocate an array of objects without filling it with 0.
Note: See TracChangeset for help on using the changeset viewer.