mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
fix: hold gil before calling tree_cache().clear()
This commit is contained in:
@@ -1503,6 +1503,8 @@ void init_transforms(nb::module_& m) {
|
|||||||
// Register static Python object cleanup before the interpreter exits
|
// Register static Python object cleanup before the interpreter exits
|
||||||
auto atexit = nb::module_::import_("atexit");
|
auto atexit = nb::module_::import_("atexit");
|
||||||
atexit.attr("register")(nb::cpp_function([]() {
|
atexit.attr("register")(nb::cpp_function([]() {
|
||||||
|
nb::gil_scoped_acquire gil;
|
||||||
|
|
||||||
tree_cache().clear();
|
tree_cache().clear();
|
||||||
mx::detail::compile_clear_cache();
|
mx::detail::compile_clear_cache();
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user