Copilot commented on code in PR #51288:
URL: https://github.com/apache/arrow/pull/51288#discussion_r3980987835


##########
r/tests/testthat/test-altrep.R:
##########
@@ -654,3 +654,63 @@ test_that("Materialized ALTREP arrays don't cause arrow to 
crash when attempting
   expect_equal(infer_type(b_int), int32())
   expect_equal(as_arrow_array(b_int), a_int)
 })
+
+test_that("strings returned by ALTREP Elt() survive garbage collection", {
+  # Base R may hold the CHARSXP returned by STRING_ELT() across an allocation,
+  # so an unmaterialized ALTREP string vector must keep every string it has
+  # handed out reachable (GH-51198). Reproducer adapted from
+  # https://gist.github.com/traversc/a5204821451198d457edc38cceda9d90
+  withr::local_options(list(arrow.use_altrep = TRUE))
+

Review Comment:
   This test enables gctorture() and allocates a 16MiB string; running it 
unconditionally in CRAN checks can be slow/flaky. Consider skipping it on CRAN 
(it can still run in CI) to reduce risk of check timeouts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to