Skip to content

Commit 6f291ed

Browse files
committed
Fix leaking pthread_attr_t
pthread_attr_destroy was not called.
1 parent 133905b commit 6f291ed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

boehmgc-coroutine-sp-fallback.diff

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
2-
index 1cee6a0b..46c3acd9 100644
2+
index 4b2c429..1fb4c52 100644
33
--- a/pthread_stop_world.c
44
+++ b/pthread_stop_world.c
5-
@@ -674,6 +674,8 @@ GC_INNER void GC_push_all_stacks(void)
5+
@@ -673,6 +673,8 @@ GC_INNER void GC_push_all_stacks(void)
66
struct GC_traced_stack_sect_s *traced_stack_sect;
77
pthread_t self = pthread_self();
88
word total_size = 0;
@@ -11,7 +11,7 @@ index 1cee6a0b..46c3acd9 100644
1111

1212
if (!EXPECT(GC_thr_initialized, TRUE))
1313
GC_thr_init();
14-
@@ -723,6 +725,28 @@ GC_INNER void GC_push_all_stacks(void)
14+
@@ -722,6 +724,31 @@ GC_INNER void GC_push_all_stacks(void)
1515
hi = p->altstack + p->altstack_size;
1616
/* FIXME: Need to scan the normal stack too, but how ? */
1717
/* FIXME: Assume stack grows down */
@@ -22,6 +22,9 @@ index 1cee6a0b..46c3acd9 100644
2222
+ if (pthread_attr_getstacksize(&pattr, &stack_limit)) {
2323
+ ABORT("GC_push_all_stacks: pthread_attr_getstacksize failed!");
2424
+ }
25+
+ if (pthread_attr_destroy(&pattr)) {
26+
+ ABORT("GC_push_all_stacks: pthread_attr_destroy failed!");
27+
+ }
2528
+ // When a thread goes into a coroutine, we lose its original sp until
2629
+ // control flow returns to the thread.
2730
+ // While in the coroutine, the sp points outside the thread stack,

0 commit comments

Comments
 (0)