Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmatch fails (crashes) when table is NULL #8

Open
EmilBode opened this issue Dec 12, 2019 · 3 comments
Open

fmatch fails (crashes) when table is NULL #8

EmilBode opened this issue Dec 12, 2019 · 3 comments

Comments

@EmilBode
Copy link

As the title says: fmatch('somevalue', c()) gives me:

Error in fmatch("somevalue", c()) :
  uable to allocate 67108864.00Mb for a hash table

(I've also seen it with 33554432.00Mb, but anyway it's trying to allocate a nearly infinte amount of memory)

It does work fine with regular length-0 vectors (e.g. giving character(0) instead of c()).

@EmilBode
Copy link
Author

I've been playing some more, but it seems this error message it only happens with me under Rstudio (1.2.1335) and R 3.6.1. Under other versions, I get the message : attempt to set an attribute on NULL, which is at least clearer.
Still, I think the best way to resolve this would be to return NA, as happens when table=character()

And for fmatch.hash (see other issue as well), returning a table of length-0 in the class of x

@ms609
Copy link

ms609 commented Sep 14, 2021

I have encountered what I believe is an equivalent error using fastmatch 1.1.0 under R 4.1.1 in RStudio.

'a' %fin% colnames(matrix(1, 1, 1)) gives

Error in "a" %fin% colnames(matrix(1, 1, 1)) :
unable to allocate 33554432.00Mb for a hash table

I expect the function to return FALSE (rather than NA), to match the behaviour of 'a' %in% colnames(matrix(1, 1, 1)).

@ms609
Copy link

ms609 commented Sep 14, 2021

I've noticed that version 1.1.3 of fastmatch has been released and resolves this issue for me. Thanks, @s-u !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants