Project

General

Profile

Actions

Bug #19029

closed

Moving a transient heap allocated array between size pools can trigger GC while in GC

Added by eightbitraptor (Matthew Valentine-House) 2 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:110136]

Description

Github PR 6466

RARRAY_PTR when called with a transient array detransients the array before returning its pointer which allocates in the heap.

Because RARRAY_PTR was being used during compaction (when re-embedding arrays that have moved between size pools) this introduces the possibility that we can hit a malloc threshold, triggering GC, while in the middle of compaction.

We should avoid this by using safer functions to get hold of the pointer. Since we know that the array is not embedded here, we can use ARY_HEAP_PTR and ARY_EMBED_PTR directly

Actions #1

Updated by eightbitraptor (Matthew Valentine-House) 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|892f350a7db4d2cc99c5061d2e74498dfc4809ca.


[Bug #19029] Don't start GC during compaction

RARRAY_PTR when called with a transient array detransients the array
before returning its pointer which allocates in the heap.

Because RARRAY_PTR was being used during compaction (when re-embedding
arrays that have moved between size pools) this introduces the
possibility that we can hit a malloc threshold, triggering GC, while in
the middle of compaction.

We should avoid this by using safer functions to get hold of the
pointer. Since we know that the array is not embedded here, we can use
ARY_HEAP_PTR and ARY_EMBED_PTR directly

Actions

Also available in: Atom PDF

Like0
Like0