Moved malloc/free for user processes to library
 -- Introduced bug: see issues