What's the difference between
buf = (char*)std::malloc(aSize * sizeof(float));
and
buf = new char[aSize * sizeof(float)];
I have seen both used, and I usually use the first. However today I noticed that the second one has started sometimes throwing std::bad_alloc and crashing. Changing it to the first fixed the issue.
What exactly does each line do?