Skip to content

stack overflow warnings/errors when comparing large(ish?) vectors of integers #101

Description

@c-tho

Running over vectors of 100k integers produces stack imbalance warnings at best and aborts the R session at worst:

# Two vectors of 100k random integers 1-12
d1 <- sample(1:12, 100000, replace = TRUE)
d2 <- sample(1:12, 100000, replace = TRUE)
# Compare
v <- stringdist::stringdist(d1, d2, method = "dl")
> Warning: stack imbalance in '<-', 2 then 21342

Attempting three of these (for three date components) within a function aborts the session, with

Error: protect(): protection stack overflow
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

This problem can be sidestepped by specifying nthread = 1. Default value for get_option("sd_num_thread") for me is 7.

sessionInfo:

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Australia.utf8    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
[1] data.table_1.14.8

loaded via a namespace (and not attached):
[1] compiler_4.2.0    cli_3.6.1         parallel_4.2.0    tools_4.2.0
[5] jsonlite_1.8.5    rlang_1.1.1       renv_0.17.3       stringdist_0.9.10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions