Added memory allocation and freeing example.