Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/bdwgc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonas echterhoff <jonas@unity3d.com>2020-05-28 21:22:42 +0300
committerGitHub <noreply@github.com>2020-05-28 21:22:42 +0300
commit69182463c88050dd7dfb7e2a65b052db01a81769 (patch)
tree176561b84cad8a5a5dddec4cd58171e7cc7213cf
parentb3a0b72cb3d3c01e62ac7757624e3f862dd970d1 (diff)
parentfa62401dff24684f8797bc355807e90d78e880af (diff)
Merge pull request #57 from Unity-Technologies/disable-automatic-collection-api
Add GC_set_disable_automatic_collection API to disable automatic periā€¦
-rw-r--r--alloc.c8
-rw-r--r--include/gc.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/alloc.c b/alloc.c
index c3562bae..f3d66540 100644
--- a/alloc.c
+++ b/alloc.c
@@ -367,6 +367,12 @@ STATIC void GC_clear_a_few_frames(void)
/* limits used by blacklisting. */
STATIC word GC_collect_at_heapsize = (word)(-1);
STATIC GC_bool GC_should_start_incremental_collection = FALSE;
+STATIC GC_bool GC_disable_automatic_collection = FALSE;
+
+GC_API void GC_set_disable_automatic_collection(GC_bool disable)
+{
+ GC_disable_automatic_collection = disable;
+}
GC_API void GC_start_incremental_collection()
{
@@ -391,6 +397,8 @@ GC_INNER GC_bool GC_should_collect(void)
GC_should_start_incremental_collection = FALSE;
return TRUE;
}
+ if (GC_disable_automatic_collection)
+ return FALSE;
return(GC_adj_bytes_allocd() >= last_min_bytes_allocd
|| GC_heapsize >= GC_collect_at_heapsize);
}
diff --git a/include/gc.h b/include/gc.h
index 3a4501ae..3d10a9a4 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -2038,6 +2038,7 @@ GC_API void GC_CALL GC_start_world_external(void);
GC_API void GC_CALL GC_disable_incremental(void);
GC_API void GC_CALL GC_start_incremental_collection (void);
+GC_API void GC_CALL GC_set_disable_automatic_collection(int);
/* APIs for getting access to raw GC heap */
/* These are NOT thread safe, so should be called with GC lock held */