That is, if my C++ application allocates memory in one thread using malloc
, will free
successfully de-allocate the memory, if called from another thread, or can I expect it to throw an exception? Both threads belong to the same process. I am using Visual Studio 2008. Thanks.
The current standard doesn't make any guarantees about threads. On most implementations, malloc
and free
may be called from different threads. Visual C++ heap code also serializes access to heaps, so you should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With