mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-01 22:58:35 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
218b78a1c9 |
+2
-1
@@ -5,7 +5,7 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from facefusion import benchmarker, cli_helper, content_analyser, hash_helper, logger, state_manager, translator
|
from facefusion import benchmarker, cli_helper, content_analyser, hash_helper, logger, memory_manager, state_manager, translator
|
||||||
from facefusion.args import apply_args, collect_job_args, reduce_job_args, reduce_step_args
|
from facefusion.args import apply_args, collect_job_args, reduce_job_args, reduce_step_args
|
||||||
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
from facefusion.download import conditional_download_hashes, conditional_download_sources
|
||||||
from facefusion.exit_helper import hard_exit, signal_exit
|
from facefusion.exit_helper import hard_exit, signal_exit
|
||||||
@@ -305,6 +305,7 @@ def process_step(job_id : str, step_index : int, step_args : Args) -> bool:
|
|||||||
logger.info(translator.get('processing_step').format(step_current = step_index + 1, step_total = step_total), __name__)
|
logger.info(translator.get('processing_step').format(step_current = step_index + 1, step_total = step_total), __name__)
|
||||||
if common_pre_check() and processors_pre_check():
|
if common_pre_check() and processors_pre_check():
|
||||||
error_code = conditional_process()
|
error_code = conditional_process()
|
||||||
|
memory_manager.release_memory()
|
||||||
return error_code == 0
|
return error_code == 0
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import ctypes
|
||||||
|
import ctypes.util
|
||||||
|
from functools import lru_cache
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
def pre_check() -> bool:
|
||||||
|
return create_static_library() is not None
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def create_static_library() -> Optional[ctypes.CDLL]:
|
||||||
|
library_path = ctypes.util.find_library('c')
|
||||||
|
|
||||||
|
if library_path:
|
||||||
|
library = ctypes.CDLL(library_path)
|
||||||
|
|
||||||
|
if hasattr(library, 'malloc_trim'):
|
||||||
|
return init_ctypes(library)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def init_ctypes(library : ctypes.CDLL) -> ctypes.CDLL:
|
||||||
|
library.malloc_trim.argtypes = [ ctypes.c_size_t ]
|
||||||
|
library.malloc_trim.restype = ctypes.c_int
|
||||||
|
|
||||||
|
return library
|
||||||
Reference in New Issue
Block a user