Memory allocation, monitoring and debugging