Sign in to follow this  
Keba

DLL question

Recommended Posts

Keba    170
Hello, i noticed that if you allocate some memory, let say the client part, and then deallocate it in the DLL you get an unhandled exception. Now i wounder why? and is it possible to deallocate something in a DLL that have been allocated somewhere else. thanks.

Share this post


Link to post
Share on other sites
chollida1    532
If you link your dll and app against the dll version of the std runtime then each of htem will have their own seperate heap. allocating in one and deleting in another causes you to try to delete memory allocated in another heap, hence the exception.

Cheers
Chris

Share this post


Link to post
Share on other sites
Galapaegos    277
Keba,

If you don't want to change this, you can write a custom memory allocator so everything comes from the same heap. But you'll have to use google on writing your own.

-brad

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this