[2186] in Kerberos_V5_Development
Re: Comments on Krb5-nt-alpha1 - DLL / Application Problems
daemon@ATHENA.MIT.EDU (Sean Moore)
Mon Jan 27 15:13:17 1997
Date: Mon, 27 Jan 1997 15:16:27 -0500
To: krbdev@MIT.EDU
From: Sean Moore <sean.moore@raleigh.hcl.com>
Cc: agray@opengroup.org, DEEngert@anl.gov
At 05:42 PM 1/25/97 -0500, Andrew Gray wrote:
>>This two can be solved by having a routine in the DLL to free
>>memory obtained by the DLL.
>
>I have been looking through the win32 snapshot for the last several
>days, and I'm a bit confused by your statement. Under Win32, dlls do
>not have their own heap, rather uses the default process heap.I cannot
>locate any point in the kerberos sources that the free function has been
>redefined to use anything but the default process heap.
Yes dlls share the same heap as the process but this is not the problem.
Each c lib has it's own heap that is uses and sub-allocates from
for performance or debugging reasons. The krb dll is linked with the static
c lib and your app is linking with another c lib. Memory malloced in
one cannot be freed in the other because they are different. This
problem is solved by every exe/dll linking with the c runtime dll
and not linking the static c lib. With ms visual c use the /MD option
(or /MDd for debug) and this way everyone will be using the same c lib plus
dll and exe size will shrink.
>Doesn't your function here just end up invoking free?
> !> KRB5_DLLIMP void KRB5_CALLCONV
> !> krb5_dll_xfree(val)
> !> void FAR * val;
> !> {
> !> krb5_xfree(val);
> !> }
Yes this works and is also a good solution because the dll that created
the memory is also freeing it.
hope this is clear.
sean