Methods and apparatus are disclosed for determining if a user-defined
software function is a memory allocation function during compile-time.
The methods and apparatus determine if a user-defined function returns a
new memory object every time the user-defined function is invoked. In
addition, the methods and apparatus determine if the memory objects
created by the user-defined function are available outside the scope of
the user defined function. If the user-defined function returns a new
memory object every time the user-defined function is invoked, and the
memory objects created by the user-defined function are not available
outside the scope of the user defined function, then the user-defined
function is determined to be a memory allocation function. Otherwise, the
user-defined function is determined to be a non-memory allocation
function.