Borrar filtros
Borrar filtros

unloadlibrary still keeps the library loaded!

14 visualizaciones (últimos 30 días)
Marc
Marc el 23 de Dic. de 2013
Respondida: Philip Borghesani el 19 de Nov. de 2015
Hello,
I have a socket communication framework wrapped inside of a library (dll). I can use it by using loadlibrary. That works fine. My problem is that calling unloadlibrary doesn't generate any error (the first time it is called), but then it appears that the library is still in memory: if I try to delete the shared library file (the dll file), Windows complains saying that some other application is using it. Only after quiting Matlab will I be able to successfully delete the library file. That makes me think: unloadlibrary is not doing its job, since Matlab is still keeping it in memory.
Am I missing something?

Respuestas (2)

Marc
Marc el 23 de Dic. de 2013
A little precision:
it seems that on specific Matlab version, or OSs (or a combination of both), unloadlibrary works fine. But in my case (Windows 8.1, Matlab R2012b), the library stays in memory (also verified with "Process explorer"
  1 comentario
Jørgen
Jørgen el 19 de Nov. de 2015
I have encountered the exact same problem with Matlab 2015A on Windows 8.1. The problem does not exist in Windows 7.
I recently filed a service request on this issue, which I hoped is answered soon.

Iniciar sesión para comentar.


Philip Borghesani
Philip Borghesani el 19 de Nov. de 2015
The problem most is most likely with your library not with MATLAB. When a library is loaded the operating system increases the load count for the library by one and unloadlibrary decrements it by one. If the count goes to 0 the operating system has the option of unloading it. Doing so is not mandatory... Any other library loading the library you are using or the library itself may be locking itself into memory by calling loadlibrary on itself.
Many libraries do not work correctly if unloaded and reloaded. Calling unloadlibrary should be considered optional.
With windows com dlls the unload is deliberately delayed to prevent thrashing when the dll is unloaded and reloaded in rapid succession.

Categorías

Más información sobre Manage Products en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by