File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ public class LLMLib
367
367
static bool has_avx = false ;
368
368
static bool has_avx2 = false ;
369
369
static bool has_avx512 = false ;
370
+ List < IntPtr > dependencyHandles = new List < IntPtr > ( ) ;
370
371
371
372
#if ( UNITY_ANDROID || UNITY_IOS ) && ! UNITY_EDITOR
372
373
@@ -498,8 +499,8 @@ public LLMLib(string arch)
498
499
{
499
500
foreach ( string dependency in GetArchitectureDependencies ( arch ) )
500
501
{
501
- Debug . Log ( $ "loading { dependency } ") ;
502
- LibraryLoader . LoadLibrary ( dependency ) ;
502
+ LLMUnitySetup . Log ( $ "Loading { dependency } ") ;
503
+ dependencyHandles . Add ( LibraryLoader . LoadLibrary ( dependency ) ) ;
503
504
}
504
505
505
506
libraryHandle = LibraryLoader . LoadLibrary ( GetArchitecturePath ( arch ) ) ;
@@ -759,6 +760,7 @@ public string GetStringWrapperResult(IntPtr stringWrapper)
759
760
public void Destroy ( )
760
761
{
761
762
if ( libraryHandle != IntPtr . Zero ) LibraryLoader . FreeLibrary ( libraryHandle ) ;
763
+ foreach ( IntPtr dependencyHandle in dependencyHandles ) LibraryLoader . FreeLibrary ( dependencyHandle ) ;
762
764
}
763
765
}
764
766
}
You can’t perform that action at this time.
0 commit comments