Skip to content

Commit

Permalink
syncronize contentious gc state
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 3, 2015
1 parent 3fd7aca commit 2fc8d97
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
extern "C" {
#endif

JL_DEFINE_MUTEX(gc)

// manipulating mark bits

#define GC_CLEAN 0 // freshly allocated
Expand Down Expand Up @@ -662,6 +664,7 @@ static NOINLINE void *malloc_page(void)
int i;
region_t* region;
int region_i = 0;
JL_LOCK(gc);
while(region_i < REGION_COUNT) {
region = regions[region_i];
if (region == NULL) {
Expand Down Expand Up @@ -729,6 +732,7 @@ static NOINLINE void *malloc_page(void)
#endif
current_pg_count++;
max_pg_count = max_pg_count < current_pg_count ? current_pg_count : max_pg_count;
JL_UNLOCK(gc);
return ptr;
}

Expand Down

1 comment on commit 2fc8d97

@JeffBezanson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see...
This goes along with the strange smell of sweep_pool_region, where the outer loop is not over per-thread heaps. This is only per-page, so it's not horrible, but still leaves a bad taste.

Please sign in to comment.