Skip to content

Commit 50a8863

Browse files
committed
fix places-GC trigger when a large message is pending
A large message that hasn't been delivered can trigger a inter-place GC. The intent is to force a GC to avoid messages piling up that can never be delivered, but the GC didn't adjust to a state where messages stay both undelivered and uncollected, and it would continuosly trigger GCs. Trigger a GC only if the pending-message size has grown relative to the previous GC.
1 parent 16678ae commit 50a8863

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

racket/src/racket/gc2/newgc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ void GC_check_master_gc_request() {
932932

933933
if (mgc) {
934934
/* check for GC needed due to GC_report_unsent_message_delta(): */
935-
if ((mgc->gen0.current_size + mgc->pending_msg_size) >= mgc->gen0.max_size) {
935+
if ((mgc->gen0.current_size + mgc->pending_msg_size) >= (mgc->gen0.max_size + mgc->prev_pending_msg_size)) {
936936
NewGC *gc = GC_get_GC();
937937

938938
if (!postmaster_and_master_gc(gc))
@@ -2749,6 +2749,8 @@ static void collect_master(Log_Master_Info *lmi) {
27492749
GCVERBOSEprintf(gc, "END MASTER COLLECTION\n");
27502750
#endif
27512751

2752+
MASTERGC->prev_pending_msg_size = MASTERGC->pending_msg_size;
2753+
27522754
{
27532755
int i = 0;
27542756
int alive = MASTERGCINFO->alive;

racket/src/racket/gc2/newgc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ typedef struct NewGC {
153153
void (*unsafe_allocation_abort)(struct NewGC *);
154154
uintptr_t memory_in_use; /* the amount of memory in use */
155155
uintptr_t pending_msg_size; /* set in master, only */
156+
uintptr_t prev_pending_msg_size; /* set in master, only */
156157

157158
/* blame the child thread infos */
158159
GC_Thread_Info *thread_infos;

0 commit comments

Comments
 (0)