Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible? 
Author Message
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?

hi,

i get the following alert when closing my application:

"Invlaid Address specified to RtlFreeHeap"

i am using some DLLs in release version in my app in debug version. i create
a dialog provided by one DLL with "new" in my app - when deleting this
object
the alert occures - is there any possibility of eliminating this error?

thanks
            philipp



Tue, 16 Aug 2005 09:36:22 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?
Suspicion is that you have multiple heaps. Unless you use dynamic linking to the MFC DLL
everywhere, you cannot allocate something in one heap and free it in another. Only the
moculde that creates it is permitted to free it. I consider multiple heaps induced by
static linking a Very Bad Idea.
                                        joe

Quote:

>hi,

>i get the following alert when closing my application:

>"Invlaid Address specified to RtlFreeHeap"

>i am using some DLLs in release version in my app in debug version. i create
>a dialog provided by one DLL with "new" in my app - when deleting this
>object
>the alert occures - is there any possibility of eliminating this error?

>thanks
>            philipp

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Tue, 16 Aug 2005 21:55:34 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?
hi joe,

thanks for the hint - i have checked all my modules on linking ( project
settings, general, use MFC in a shared DLL ) but i think there is no
mistake... ( or do i have to check at other places? )

the curious thing is that everything works fine if i start my app in release
(linking the my modules release versions) but the error occures if i start
my app in
debug mode (also linking my modules release versions).

i am creating a new object of type CPHDisplay in the OnInitDialog of my test
app this way

m_pPHDisplay = new CPHDisplay( CPHDisplay::typeChild, CRect( 0, 0, 100,
100 ), this );

and calling

if( m_pPHDisplay )
{
    delete m_pPHDisplay;
    m_pPHDisplay = 0;

Quote:
}

in the destructor of my test app...

so is there any mistake (multiple heaps) ?

i am also calling

if( GetSafeHwnd() )
  DestroyWindow();

within the destructor of my CPHDisplay class - perhaps i should not do this?

thanks in advance

                            philipp



Wed, 17 Aug 2005 10:56:42 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?

Quote:

> hi joe,

> thanks for the hint - i have checked all my modules on linking ( project
> settings, general, use MFC in a shared DLL ) but i think there is no
> mistake... ( or do i have to check at other places? )

Yes, you do have to check other places.  The Rtl is not part of MFC, it
is part of the C++ runtime library.  Check the setting for 'use
runtime-library' in C/C++ settings.  All modules should use the
multithreaded DLL RTL, and all should use the debug version in debug
build and the release version in release build.  See /MD in the help.

You can check this with the Depends tool.  Check each exe/dll and make
sure it uses msvcrt.dll (release) or msvcrtd.dll (debug).

--
Scott McPhillips [VC++ MVP]



Wed, 17 Aug 2005 16:21:16 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?
hi,

ok i have also checked the correct settings for the rtl now - i did not have
to change anything...

i have read the first notes in the help ( /MD, /ML, /MT, /LD   (Use Run-Time
Library) ) where i found the following:

(You should also avoid mixing the debug and non-debug versions of the
libraries in one process.)

does this mean that it is impossible to run a debug version of a program
using the release version of my dlls?

thanks, philipp



Thu, 18 Aug 2005 19:48:12 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?

Quote:

> hi,

> ok i have also checked the correct settings for the rtl now - i did not have
> to change anything...

> i have read the first notes in the help ( /MD, /ML, /MT, /LD   (Use Run-Time
> Library) ) where i found the following:

> (You should also avoid mixing the debug and non-debug versions of the
> libraries in one process.)

> does this mean that it is impossible to run a debug version of a program
> using the release version of my dlls?

> thanks, philipp

It is possible to mix debug and release versions if you do not pass
anything across the interface that will be reallocated.  For example,
all the API functions you call are in a release DLL.  But if you pass
across dynamic self-reallocating objects like CString and vector then it
can't work.

--
Scott McPhillips [VC++ MVP]



Thu, 18 Aug 2005 20:21:01 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?
Basically, yes. You can't really mix DLLs effectively if they think they are sharing the
same heap.
                                joe

Quote:

>hi,

>ok i have also checked the correct settings for the rtl now - i did not have
>to change anything...

>i have read the first notes in the help ( /MD, /ML, /MT, /LD   (Use Run-Time
>Library) ) where i found the following:

>(You should also avoid mixing the debug and non-debug versions of the
>libraries in one process.)

>does this mean that it is impossible to run a debug version of a program
>using the release version of my dlls?

>thanks, philipp

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Fri, 19 Aug 2005 09:53:59 GMT  
 Invalid Address specified to RtlFreeHeap - Using release versions of a DLL in a debug version of an exe - Impossible?
THe problem is that the release DLLs use the release MFC library (MFC42.DLL), which has
its own heap, and debug executables and DLLs use the debug MFC library (MFC42D.DLL) which
has its own heap. So something allocated from one heap cannot be freed into another heap.
Generally, if you follow the rule that only the component that allocates is permitted to
release, you will have no problem, but if you allocate from one component and free in
another, you are in trouble.
                                        joe

Quote:

>hi joe,

>thanks for the hint - i have checked all my modules on linking ( project
>settings, general, use MFC in a shared DLL ) but i think there is no
>mistake... ( or do i have to check at other places? )

>the curious thing is that everything works fine if i start my app in release
>(linking the my modules release versions) but the error occures if i start
>my app in
>debug mode (also linking my modules release versions).

>i am creating a new object of type CPHDisplay in the OnInitDialog of my test
>app this way

>m_pPHDisplay = new CPHDisplay( CPHDisplay::typeChild, CRect( 0, 0, 100,
>100 ), this );

>and calling

>if( m_pPHDisplay )
>{
>    delete m_pPHDisplay;
>    m_pPHDisplay = 0;
>}

>in the destructor of my test app...

>so is there any mistake (multiple heaps) ?

>i am also calling

>if( GetSafeHwnd() )
>  DestroyWindow();

>within the destructor of my CPHDisplay class - perhaps i should not do this?

>thanks in advance

>                            philipp

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Fri, 19 Aug 2005 10:19:02 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. "Invalid Address specified to RtlFreeHeap(..)"

2. Invalid Address specified to RtlFreeHeap (Debug in Win2000 Proffesional+SP3)

3. Invalid Address specified to RtlFreeHeap

4. Invalid Address specified to RtlFreeHeap ...

5. Invalid Address specified to RtlFreeHeap( 80000, 859ce0 )

6. Invalid Address specified to RtlValidateHeap (non-dll)

7. Invalid Address specified to RtlValidateHeap in EXE Server

8. Invalid Address specified to RtlValidateHeap

9. HEAP[my.exe]: Invalid Address specified to RtlValidateHeap( 1940000, 1b73290 )

10. Invalid Address specified to RtlValidateHeap

11. Invalid Address specified to RtlValidateHeap

12. Invalid Address specified to RtlValidateHeap

 

 
Powered by phpBB® Forum Software