Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:34:44+00:00 2026-05-31T17:34:44+00:00

I have rather large project that uses ICU regex classes. Basically it might run

  • 0

I have rather large project that uses ICU regex classes. Basically it might run in single-threaded mode, and in multi-threaded mode. In latter case all threads initialize own internal data (including regexes they use).

Originally project used shared_ptr to RegexPattern class to store regular expression for further use.
I identified RegexPattern::matcher() call to be a bottleneck as it involves extra memory allocation to allocate new RegexMatcher class, so I decided to switch to store shared_ptr to RegexMatcher, and just call reset(str) before calling match.

I want to stress again – regexes are not shared between threads.

So it all went fine in single-threaded mode, and app worked slightly faster as I expected.
However when I tried to run ~10 processing threads at once ICU library started to give weird results – in debug build some parts of data were partially initialized, some invalid values poped up here and there.

I looked at the ICU code and don’t see any static stuff that might cause such behavior.

So the questions are (mostly they cause by the lack of appropriate documentation):
1) Is it valid scenario to store RegexMatcher instead of RegexPattern (RegexMatcher has a member pointing to the pattern being used)?
2) Are there any limitations on multithreading usage of ICU regexes not listed in documentation?

Just to note: my dev platform is Visual C++ 2010, compiling for Win32

Note: I was not able to reproduce such weird behavior in isolated test application that does only regex matching in 10 threads simultaneously, that’s why questions are rather open-ended.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:34:45+00:00Added an answer on May 31, 2026 at 5:34 pm

    Actually I was wrong – there is a case when single regexp is used from different threads. Obviously it cases issues when using RegexMatcher instead of RegexPattern

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large project that uses Oracle ODP.NET. Right now it is
I'm building a rather large project, that basically consists of this: Server 1: Ice
I have a rather large program that uses Hibernate for its ORM needs. Due
I have a rather large project which contains a number of third-party dependencies which
I have a rather large project developed on Sharepoint and Project Server, designed as
I have a rather large (freeware) project written with Delphi 2007 which is using
I have rather large input XML files that must be converted to a given
I have a rather large (many gigabytes) table of data in SQL Server that
I have a rather large (80k loc) java desktop app that talks to a
I have a rather large list of data that contains 5 properties per element.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.