Link to home
Start Free TrialLog in
Avatar of nweiher
nweiher

asked on

Freeing Allocated Memory

Is there a known problem where memory is allocated (via malloc) in a C Based DLL, passing the allocated memory address back to an appication thru a callback function setting the address as an LParam? What seems to be happening (using NT) is that MFC application crashes whenever the application frees the memory (LParam Address) using free.
Avatar of captainkirk
captainkirk

The memory allocated in the DLL is from its own memory pool unless it is an MFC Extension DLL. You may want to see if you can free the memory inside the DLL.
Possible problem could be that MFC app and your C dll were compiled with different versions of C runtime library
ASKER CERTIFIED SOLUTION
Avatar of DKostov
DKostov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Under debug - MFC uses a different malloc to that in release to enable it to do memory tracking. so mixing release and debug MFC builds can cause problems the same may also apply to 'vanilla' C dlls also.

"DKostov", since you were the one who answered the question at the address you've given, why not simply copy it over here!
"Try",
The discussion there is huge.