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

U_MEMORY_ALLOCATION_ERROR when using :pattern_rule_based in ICU::NumberFormatting #62

Open
codealchemy opened this issue May 19, 2023 · 1 comment

Comments

@codealchemy
Copy link
Collaborator

Seen on both amd64 and arm64 (M1 macOS) machines.

First seen on Ruby 3.2 (Ubuntu Jammy with ICU 71.1) and reproduced on an M1 with Ruby 3.2, 3.1, and 3.0 using ICU 70.2.

To reproduce:

irb(main):002:0> require 'ffi-icu'
=> true
irb(main):003:0> ICU::NumberFormatting.create('fr', :pattern_rule_based)
/Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/lib.rb:138:in `check_error': U_MEMORY_ALLOCATION_ERROR (ICU::Error)
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:50:in `make_formatter'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:57:in `initialize'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:12:in `new'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:12:in `create'
        from (irb):3:in `<main>'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
        from /Users/primary_user/.rbenv/versions/3.0.4/bin/irb:25:in `load'
        from /Users/primary_user/.rbenv/versions/3.0.4/bin/irb:25:in `<main>'
irb(main):004:0> ICU::NumberFormatting.create('en', :pattern_rule_based)
/Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/lib.rb:138:in `check_error': U_MEMORY_ALLOCATION_ERROR (ICU::Error)                                                             
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:50:in `make_formatter'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:57:in `initialize'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:12:in `new'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/ffi-icu-0.5.0/lib/ffi-icu/number_formatting.rb:12:in `create'
        from (irb):4:in `<main>'
        from /Users/primary_user/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
        from /Users/primary_user/.rbenv/versions/3.0.4/bin/irb:25:in `load'
        from /Users/primary_user/.rbenv/versions/3.0.4/bin/irb:25:in `<main>'
@erickguan
Copy link
Owner

I would support deprecate the use of unum_open and use unumf_openForSkeletonAndLocale. ICU unumf_openForSkeletonAndLocale is stable since ICU 62 (2018-06-20). So supporting the "skeleton" instead of extending the support around unum_open.

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