nix_api_expr: add nix_gc_now()

This commit is contained in:
Yorick van Pelt 2023-07-28 13:47:54 +02:00 committed by José Luis Lafuente
parent ded0ef6f6c
commit ada2af4f88
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
2 changed files with 12 additions and 2 deletions

View file

@ -132,9 +132,12 @@ void nix_gc_decref(const void *p) {
// todo: else { throw? } // todo: else { throw? }
} }
void nix_gc_now() { GC_gcollect(); }
#else #else
void nix_gc_incref(const void *){}; void nix_gc_incref(const void *) {}
void nix_gc_decref(const void *){}; void nix_gc_decref(const void *) {}
void nix_gc_now() {}
#endif #endif
void nix_gc_register_finalizer(void *obj, void *cd, void nix_gc_register_finalizer(void *obj, void *cd,

View file

@ -128,6 +128,13 @@ void nix_gc_incref(const void *);
*/ */
void nix_gc_decref(const void *); void nix_gc_decref(const void *);
/**
* @brief Trigger the garbage collector manually
*
* You should not need to do this, but it can be useful for debugging.
*/
void nix_gc_now();
/** /**
* @brief Register a callback that gets called when the object is garbage * @brief Register a callback that gets called when the object is garbage
* collected. * collected.