Index: doc/theses/mubeen_zulfiqar_MMath/allocator.tex
===================================================================
--- doc/theses/mubeen_zulfiqar_MMath/allocator.tex	(revision 1f8dbfec7408d441cd40f309f2908501a20a964c)
+++ doc/theses/mubeen_zulfiqar_MMath/allocator.tex	(revision 3d7d407c86239c5ee651fee5045aca8ced5be3fb)
@@ -350,4 +350,96 @@
 
 \subsection{Alloc Interface}
-Why did we need it?
-The added benefits.
+In addition to improve allocator interface both for CFA and our standalone allocator uHeapLmmm in C. We also added a new alloc interface in CFA that increases usability of dynamic memory allocation.
+This interface helps programmers in three major ways.
+\begin{itemize}
+\item
+Routine Name: alloc interfce frees programmers from remmebring different routine names for different kind of dynamic allocations.
+\item
+Parametre Positions: alloc interface frees programmers from remembering parameter postions in call to routines.
+\item
+Object Size: alloc interface does not require programmer to mention the object size as CFA allows allocator to determince the object size from returned type of alloc call.
+\end{itemize}
+
+Alloc interface uses polymorphism, backtick routines (FIX ME: cite backtick) and ttype parameters of CFA (FIX ME: cite ttype) to provide a very simple dynamic memory allocation interface to the programmers. The new interfece has just one routine name alloc that can be used to perform a wide range of dynamic allocations. The parameters use backtick functions to provide a similar-to named parameters feature for our alloc interface so that programmers do not have to remember parameter positions in alloc call except the position of dimension (dim) parameter.
+
+\subsubsection{Routine: T * alloc( ... )}
+Call to alloc wihout any parameter returns one object of size of type T allocated dynamically.
+Only the dimension (dim) parameter for array allocation has the fixed position in the alloc routine. If programmer wants to allocate an array of objects that the required number of members in the array has to be given as the first parameter to the alloc routine.
+alocc routine accepts six kinds of arguments. Using different combinations of tha parameters, different kind of allocations can be performed. Any combincation of parameters can be used together except `realloc and `resize that should not be used simultanously in one call to routine as it creates ambiguity about whether to reallocate or resize a currently allocated dynamic object. If both `resize and `realloc are used in a call to alloc then the latter one will take effect or unexpected resulted might be produced.
+
+\paragraph{Dim}
+This is the only parameter in the alloc routine that has a fixed-position and it is also the only parameter that does not use a backtick function. It has to be passed at the first position to alloc call in-case of an array allocation of objects of type T.
+It represents the required number of members in the array allocation as in CFA's aalloc (FIX ME: cite aalloc).
+This parameter should be of type size_t.
+
+Example: int a = alloc( 5 )
+This call will return a dynamic array of five integers.
+
+\paragraph{Align}
+This parameter is position-free and uses a backtick routine align (`align). The parameter passed with `align should be of type size_t. If the alignment parameter is not a power of two or is less than the default alignment of the allocator (that can be found out using routine libAlign in CFA) then the passed alignment parameter will be rejected and the default alignment will be used.
+
+Example: int b = alloc( 5 , 64`align )
+This call will return a dynamic array of five integers. It will align the allocated object to 64.
+
+\paragraph{Fill}
+This parameter is position-free and uses a backtick routine fill (`fill). In case of realloc, only the extra space after copying the data in the old object will be filled with given parameter.
+Three types of parameters can be passed using `fill.
+\begin{itemize}
+\item
+char: A char can be passed with `fill to fill the whole dynamic allocation with the given char recursively till the end of required allocation.
+\item
+Object of returned type: An object of type of returned type can be passed with `fill to fill the whole dynamic allocation with the given object recursively till the end of required allocation.
+\item
+Dynamic object of returned type: A dynamic object of type of returned type can be passed with `fill to fill the dynamic allocation with the given dynamic object. In this case, the allocated memory is not filled recursively till the end of allocation. The filling happen untill the end object passed to `fill or the end of requested allocation reaches.
+\end{itemize}
+
+Example: int b = alloc( 5 , 'a'`fill )
+This call will return a dynamic array of five integers. It will fill the allocated object with character 'a' recursively till the end of requested allocation size.
+
+Example: int b = alloc( 5 , 4`fill )
+This call will return a dynamic array of five integers. It will fill the allocated object with integer 4 recursively till the end of requested allocation size.
+
+Example: int b = alloc( 5 , a`fill ) where a is a pointer of int type
+This call will return a dynamic array of five integers. It will copy data in a to the returned object non-recursively untill end of a or the newly allocated object is reached.
+
+\paragraph{Resize}
+This parameter is position-free and uses a backtick routine resize (`resize). It represents the old dynamic object (oaddr) that the programmer wants to
+\begin{itemize}
+\item
+resize to a new size.
+\item
+realign to a new alignment
+\item
+fill with something.
+\end{itemize}
+The data in old dynamic object will not be preserved in the new object. The type of object passed to `resize and the returned type of alloc call can be different.
+
+Example: int b = alloc( 5 , a`resize )
+This call will resize object a to a dynamic array that can contain 5 integers.
+
+Example: int b = alloc( 5 , a`resize , 32`align )
+This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32.
+
+Example: int b = alloc( 5 , a`resize , 32`align , 2`fill)
+This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32 and will be filled with 2.
+
+\paragraph{Realloc}
+This parameter is position-free and uses a backtick routine realloc (`realloc). It represents the old dynamic object (oaddr) that the programmer wants to
+\begin{itemize}
+\item
+realloc to a new size.
+\item
+realign to a new alignment
+\item
+fill with something.
+\end{itemize}
+The data in old dynamic object will be preserved in the new object. The type of object passed to `realloc and the returned type of alloc call cannot be different.
+
+Example: int b = alloc( 5 , a`realloc )
+This call will realloc object a to a dynamic array that can contain 5 integers.
+
+Example: int b = alloc( 5 , a`realloc , 32`align )
+This call will realloc object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32.
+
+Example: int b = alloc( 5 , a`realloc , 32`align , 2`fill)
+This call will resize object a to a dynamic array that can contain 5 integers. The returned object will also be aligned to 32. The extra space after copying data of a to the returned object will be filled with 2.
