Implement heap allocation functions