- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I turned some computational code into a dll in order to call it from a VB interface. It works great. However, I call the dll multiple times. It stays resident in memory and variables retain their values from the first call. This is inheritied code from old programmers that didn't take the time to declare their variables. I would rather find a way to clear it out of memory than document every variable and re-initialize them all. I haven't been able to locate methods in either VB or Fortran to force the dll to clear.
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I don't know of a way to do this from VB - it is the one loading the DLL. All you can do on the Fortran side is add code to initialize the variables.
You'd have to convince VB to do an UnloadLibrary on the DLL, but that may cause VB to lose track of the DLL and cause more problems.
Steve
You'd have to convince VB to do an UnloadLibrary on the DLL, but that may cause VB to lose track of the DLL and cause more problems.
Steve
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
You could try creating a DLL middle-man that calls LoadLibrary, GetProcAddress, forwards the call, and calls FreeLibrary every time.
Your call as to where you want to spend your time, fixing the older code, or working around its 'issues' and the performance of your work-around.
hth,
John
Your call as to where you want to spend your time, fixing the older code, or working around its 'issues' and the performance of your work-around.
hth,
John
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
John, that's a wonderful suggestion! I wish I had thought of it the last couple of times we'd been asked this! I agree that fixing the code is a more appropriate solution, but yours isn't hard to implement.
Steve
Steve
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Every now and then, I get a decent idea - or much more likely, remember someone else's idea :) ... that's probably the case here :)
-John
-John
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi John:
Granted, FreeLibrary ultimately reduces the usage count to zero and unmaps the library/module from the process. But does it warrant the near-instantaneous or otherwise deallocation of memory? IMO, it's usage is not a substitute for explicitly (re)initializing variables as required.
Best,
Gerry T.
Granted, FreeLibrary ultimately reduces the usage count to zero and unmaps the library/module from the process. But does it warrant the near-instantaneous or otherwise deallocation of memory? IMO, it's usage is not a substitute for explicitly (re)initializing variables as required.
Best,
Gerry T.

Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite