I see in C++ there are multiple ways to allocate and free data and I understand that when you call malloc you should call free and when you use the
malloc
free
If you have C code you want to port over to C++, you might leave any malloc() calls in it. For any new C++ code, I'd recommend using new instead.