Board index » cppbuilder » CG: Resource from different RTL ???

CG: Resource from different RTL ???

What causes Code Guard to identify a memory leek with the warning
'Resource from different RTL'?  This keeps occurring when I have apps
using dynamic packages even though the memory is created and deleted by
the same package as far as i am concerned.

Paul

PS How about a Code Guard newsgroup?

 

Re:CG: Resource from different RTL ???


Hi Paul,

Quote
> What causes Code Guard to identify a memory leek with the warning
> 'Resource from different RTL'?

The usual cause would be when an app static links
to the RTL and allocates a resource (memory, file
handle) and passes the resource to a DLL that
static links to the RTL and the DLL then free's
the resource. The resolution there would be
to link both app and dll dynamically to the
RTL (one copy of the RTL in that process).

Quote
>  This keeps occurring when I have apps
> using dynamic packages even though the memory is created and deleted

I'm not sure how packages relate to the error. When
you create a new VCL DLL there is a comment in the
source about using the Borland memory manager when linking
statically. Do you static link the Packages to the RTL?

--Craig

Re:CG: Resource from different RTL ???


Hi Craig

Thanks for the assistance.

Both app and package use static RTL and both have Borland mmemgr.lib
included.

Changing to dynamic RTL gets rid of the warning - thank you!

Quote
Craig Farrell wrote:

> Hi Paul,

> > What causes Code Guard to identify a memory leek with the warning
> > 'Resource from different RTL'?

> The usual cause would be when an app static links
> to the RTL and allocates a resource (memory, file
> handle) and passes the resource to a DLL that
> static links to the RTL and the DLL then free's
> the resource. The resolution there would be
> to link both app and dll dynamically to the
> RTL (one copy of the RTL in that process).

> >  This keeps occurring when I have apps
> > using dynamic packages even though the memory is created and deleted

> I'm not sure how packages relate to the error. When
> you create a new VCL DLL there is a comment in the
> source about using the Borland memory manager when linking
> statically. Do you static link the Packages to the RTL?

> --Craig

Other Threads