Y
Yuval Steinberg
Hello,
Recently we've upgraded to use MsDev 2008 for our code (until now
we've used MsDev 2005).
Unfortunately we are using some 3rd party DLLs that were build in
MsDev 2005, and there are a few methods in those DLL that are
allocating memory, which I as a client need to free. I have no control
of them, so I cannot change the interface or the way memory
allocations work, nor is there a way for us to recieve these DLLs
build with MsDev 2008. There are also some places where allocations
are done on our side and are freed by their DLL (I know this is bad
exercise, but that's they way the 3rd party enforces....)
As you can guess - our software crashes because of this mixture
(memory allocations are done with MSVCR80 and freed with MSVCR90, or
viceversa, causing different heaps to be used...).
My question: Is there a way to enforce the 3rd party DLL to use the
same heap (i.e. use MSVCR90) as my software? I'm really lost...
BTW - I've investigated it and I must add that even there was no cross
memory allocation/deallocation, there are still problems when running
with several heaps - if memory is not freed (and say that it is still
used, no leak), then each page taken by a heap is not available for
the other heap. So if the other DLL needs a lot of space at some point
and frees most of it, but still takes many pages, my main program is
left with less available heap then expected.
Recently we've upgraded to use MsDev 2008 for our code (until now
we've used MsDev 2005).
Unfortunately we are using some 3rd party DLLs that were build in
MsDev 2005, and there are a few methods in those DLL that are
allocating memory, which I as a client need to free. I have no control
of them, so I cannot change the interface or the way memory
allocations work, nor is there a way for us to recieve these DLLs
build with MsDev 2008. There are also some places where allocations
are done on our side and are freed by their DLL (I know this is bad
exercise, but that's they way the 3rd party enforces....)
As you can guess - our software crashes because of this mixture
(memory allocations are done with MSVCR80 and freed with MSVCR90, or
viceversa, causing different heaps to be used...).
My question: Is there a way to enforce the 3rd party DLL to use the
same heap (i.e. use MSVCR90) as my software? I'm really lost...
BTW - I've investigated it and I must add that even there was no cross
memory allocation/deallocation, there are still problems when running
with several heaps - if memory is not freed (and say that it is still
used, no leak), then each page taken by a heap is not available for
the other heap. So if the other DLL needs a lot of space at some point
and frees most of it, but still takes many pages, my main program is
left with less available heap then expected.