ORA_FFI and freeing memory

From: Antti Jarvinen <costello_at_iki.fi>
Date: 01 Mar 1999 15:04:08 +0200
Message-ID: <x1n21x8ipj.fsf_at_opp6.i-have-a-misconfigured-system-so-shoot-me>



Dear sirs,

does anyone in here have good ideas about what should I do in order to deallocate a amount of memory allocated by loading and using a .DLL (in NT4) with forms5 and ORA_FFI-package? I've tried using ORA_FFI.UNLOAD_LIBRARY but it doesn't free any memory - is there method of unloading a DLL in NT? I've been thinking about calling something from USER.EXE that would unload a DLL but that then would require using ORA_FFI package leaving the USER.EXE loaded and that might also consume some amount of memory.

This is what I've done:

PACKAGE BODY burb IS
FUNCTION ff_foo(ff_handle ORA_FFI.FUNCHANDLETYPE)

		  RETURN binary_integer;
		  PRAGMA interface(C, ff_foo, 11265);

FUNCTION foo RETURN binary_integer IS
BEGIN
  RETURN(ff_foo(funktio));
END;
procedure lataa_pois is
begin
 ora_ffi.unload_library(kirjasto) ;
end ;
begin
  kirjasto := ora_ffi.load_library('m:\oraffitest\debug\','oraffitest.dll') ;   funktio := ora_ffi.register_function(kirjasto, 'foo',ora_ffi.c_std) ;   ora_ffi.register_return(funktio,ORA_FFI.C_INT); exception
 when others then
   message(error_text) ;
end ;

So what I do: first call burb.foo when I want foo done and it works like a charm - at some point I don't need foo anymore so I call burb.lataa_pois (oops, finnish language, meaning "unload" :) but no memory is freed (according to nt performance monitor) and this is kind of bad thing because in my case foo is pretty big. It seems like I need to exit from forms runtime before the .DLL actually gets unloaded.

Any good ideas?

-- 
Antti Järvinen, costello_at_iki.fi
            "concerto for two faggots and orchestra" 
Received on Mon Mar 01 1999 - 14:04:08 CET

Original text of this message