int test()
{
void *pDllHandle;
TDAppl pAppl;
pDllHandle = dlopen(sApplName, RTLD_LAZY);
if(pDllHandle == NULL)
{
...
}
else
{
pAppl =(TDAppl) dlsym( pDllHandle, "fnApplication");
if(pAppl == NULL)
{
...
}
j = pAppl((void *)ACG_message);
dlclose(pDllHandle);
}
}
When i call test in a for/next Loop, the memory of the system
decreases continously.
It seems, that the dlclose does not release the (memory) resources the
shared object uses.
Anyone got any hint ????
Thanks,
J. Riedel
I hope this helps,
Marcelo
Usually, memory is only returned to the system when the process exits.
Jonas Riedel wrote:
>
> Hi,
> I am using shared objects in my C-Program with dlopen, dlsym and
> dlclose.
> Source looks like:
>
> int test()
> {
...
> }
>
> When i call test in a for/next Loop, the memory of the system
> decreases continously.
>
> It seems, that the dlclose does not release the (memory) resources the
> shared object uses.
>
> Anyone got any hint ????
>
> Thanks,
>
> J. Riedel
--
----------------
Marcelo L. Meira, Programmer
spam bait: postmaster@localhost
e-mail: marcelo.meira at waii dot com
Western Geophysical - (713) 689-2679
"UNIX _IS_ user friendly; it's just picky about who its friends are."
>When i call test in a for/next Loop, the memory of the system
>decreases continously.
>
>It seems, that the dlclose does not release the (memory) resources the
>shared object uses.
Three possibilities come to mind:
* pAppl() malloc()s some memory which you are failing to free()
(directly or via a pApplFree()-like call)
* the library initializes some private data structure which
is not being released in the dlclose()
* the dl*() functions themselves are buggy WRT memory leaks
--Ken Pizzini