Author Topic: Found a lock-free allocator, will this help?  (Read 5581 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Found a lock-free allocator, will this help?
« on: May 09, 2011, 10:19:46 pm »
Hi guys, I was researching on multithreading, and I found this little gem: Streamflow. It's a lock-free allocator for multithreaded apps. It means that you can allocate and deallocate as many objects as you can and it won't block the main thread for allocating memory.

http://people.cs.vt.edu/~scschnei/streamflow/

I was wondering if this could speed up some part of Codeblocks (code completion, perhaps? Search plugins?). What do you think?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Found a lock-free allocator, will this help?
« Reply #1 on: May 10, 2011, 02:48:11 am »
The current allocator implementation in Codeblocks' SDK is not thread safe, see:
Re: using memory pool for the SearchTree Node
So, we have only One parserthread thread running at a time.

This "streamflow" can safely allocate memories from multiply thread?
I can see it's code, but have no idea how to use it, and does it multi platform support?

thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Found a lock-free allocator, will this help?
« Reply #2 on: May 10, 2011, 07:52:42 am »
I think the answer is quite simple: As this is a Linux-only project, there is no way we can make use of it. (It uses Linux headers all over the place... :shock:)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Found a lock-free allocator, will this help?
« Reply #3 on: May 10, 2011, 06:58:49 pm »
What about Intel Threading Building Blocks? It includes a memory allocator as well, and I think the license would allow us to use it in Code::Blocks.

Of course the real benefit comes from proper multithreading, for which we could also use the same library (both containers and algorithms).