Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Using Hoard Memory Manager with C++ Builder


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 9 - Last Post: May 25, 2016 8:51 AM Last Post By: Alex Belo
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2016 8:45 AM
hi

I want to use Hoard memory manager inside my C++ Builder apps found in the following links:

http://plasma.cs.umass.edu/emery/using-hoard.html
http://plasma.cs.umass.edu/emery/download-hoard.html

But the "winhoard.lib" shipped with it is VC++ so i had to generate a new .lib from the .dll using implib:

implib winhoard.lib winhoard.dll


Then i add both "winhoard.lib" and "usewinhoard.cpp" as described in the how to use it. unchecked RTL linking and everything compiles fine and i ran the app but nothing happened, not in a bad way the app started normally and that's it.

I HAVE NO IDEA IF I AM USING THE NEW MEMORY MANAGER NOW OR NOT?

So, the question is has anyone managed to make that memory manager to work with c++ builder and if please tell me how?

Also, if what i have done is correct how can i check if i am using the Hoard Memory Manager?

Any help will be appreciated.

Thanks in advance
--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2016 11:13 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Tue, 17 May 2016 08:45:21 -0700, Ahmed Sayed <> wrote:

So, the question is has anyone managed to make that memory manager to work with c++ builder and if please tell me how?

IIRC I used hoard with bcb5 ~15 years ago but unfortunately cannot remember any specific details on how I managed to install it

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 18, 2016 1:22 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Well, If I can't use Hoard with C++ Builder is there any other memory manager that works perfectly with c++ builder for multi-threaded apps and dlls. Because Delphi's default FastMM4 is not that cool and have a lot of issues.

--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 18, 2016 1:42 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Wed, 18 May 2016 01:22:43 -0700, Ahmed Sayed <> wrote:

Well, If I can't use Hoard with C++ Builder is there any other memory manager that works perfectly with c++ builder for multi-threaded apps and dlls. Because Delphi's default FastMM4 is not that cool and have a lot of issues.

among others see freely available tbbmm and commercial nexusmm heap allocators
it shouldn't be that hard to bind any other allocator of your choice to vcl memory manager stubs once you get the idea how other
implementations achieved that

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 18, 2016 2:15 PM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir Ulchenko wrote:
On Wed, 18 May 2016 01:22:43 -0700, Ahmed Sayed <> wrote:

Well, If I can't use Hoard with C++ Builder is there any other memory manager that works perfectly with c++ builder for multi-threaded apps and dlls. Because Delphi's default FastMM4 is not that cool and have a lot of issues.

among others see freely available tbbmm and commercial nexusmm heap allocators
it shouldn't be that hard to bind any other allocator of your choice to vcl memory manager stubs once you get the idea how other
implementations achieved that

--
Vladimir Ulchenko aka vavan

Thanks I will give it a try.

--
The limits of my language mean the limits of my world
Alex Belo

Posts: 626
Registered: 10/8/06
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 18, 2016 5:29 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed Sayed wrote:

other memory manager

You can try SAP (32 bit only)
https://code.google.com/archive/p/sapmm/
https://github.com/alan008/sapmm

--
Alex
David Millington

Posts: 257
Registered: 5/29/05
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 24, 2016 7:38 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On 2016-05-18 08:22:43 +0000, Ahmed Sayed said:

Because Delphi's default FastMM4 is not that cool and have a lot of issues.

What issues? It's normally regarded as an excellent MM, and work is
ongoing for improved performance in heavily multithreaded scenarios.

If you have specific issues, have you filed them in QP?

--
Parnassus: Tools for Delphi programmers. Making the IDE better.
https://parnassus.co/delphi-tools/

Parnassus Bookmarks: replace the IDE's bookmarks with something better.
Never overwrite a bookmark, one shortcut key, dockable list, free.
Parnassus Navigator: jump anywhere in your code - the uses clause, a
property declaration, a method. Ctrl+G, type, all useful items in your
code are filtered as you type. Plus, adds a minimap!

Alex Belo

Posts: 626
Registered: 10/8/06
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 25, 2016 12:53 AM   in response to: David Millington in response to: David Millington
David Millington wrote:

What issues? It's normally regarded as an excellent MM, and work is
ongoing for improved performance in heavily multithreaded scenarios.

It has global critical section so it serves only 1 thread at time. This
is the reason why it is not well-scalable on multicore CPUs. This
problem is visible/critical under havy get/free memory operations (like
concatenation of Delphi strings) in concurrent threads.

Old but still actual post:

FastMM - Slow in multithreaded apps on multicore CPUs
http://zachsaw.blogspot.ru/2010/01/fastmm-slow-in-multithreaded-apps-on.html

Modern MMs create separate instance of memory manager in every thread
to solve this problem. Main drawbacks of this solution are additional
memory consumption and synchronisation (global again) of deallocation
of memory blocks allocated in other thread (in other instance of MM in
fact). Last problem is not critical because most of allocated memory
blocks in OO code (including many instances of temporary objects)
usually will be deallocated in the same thread.

--
Alex
David Millington

Posts: 257
Registered: 5/29/05
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 25, 2016 2:18 AM   in response to: Alex Belo in response to: Alex Belo
Have you been following the latest commits? Eg https://github.com/pleriche/FastMM4/commits/master/FastMM4.pas

There's some very interesting-looking work being done. There have been several discussions on the Delphi Developers Google+ group about it over the past couple of months. In terms of stability, from memory, Eric Grange's beginend.net is running using the latest on the server, and it's reportedly stable and fast.

Modern MMs create separate instance of memory manager in every thread
to solve this problem. Main drawbacks of this solution are additional
memory consumption and synchronisation (global again) of deallocation
of memory blocks allocated in other thread (in other instance of MM in
fact). Last problem is not critical because most of allocated memory
blocks in OO code (including many instances of temporary objects)
usually will be deallocated in the same thread.

I actually wrote my own memory manager once, about three or four years ago, so I'm familiar with the approaches and problems. It's one reason I commented in this thread, because I'm interested :) Mine was never stable enough to publicly release, though, and with the new changes to FastMM I think there's no need to.

As far as using Hoard goes, have you wrapped the DLL in the RTL's memory manager API? If you do, and if it works well, it would be great if you can post about the results you get.

The MM API: http://docwiki.embarcadero.com/Libraries/Seattle/en/System.SetMemoryManager (you may need to do something else to allow C++ to use this; not sure. The docs say "Delphi only". I remember FastMM has some C++ code in the RTL source folder. It's been a long time since I looked into this.)

The Delphi Dev G+ group: https://plus.google.com/u/0/communities/103113685381486591754

Cheers,

David
Alex Belo

Posts: 626
Registered: 10/8/06
Re: Using Hoard Memory Manager with C++ Builder  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 25, 2016 8:51 AM   in response to: David Millington in response to: David Millington
David Millington wrote:

Have you been following the latest commits?

No, I still use RAD2007 and default MM. It is quite good for my
multithreading because real time critical parts (like real time image
processing) I do in dll compiled with Intel tools; CBuilder MT code is
mostly for dispatching and visualization.

Anyway thank you for information, I hope I'll take a look later when I
retun from physicians' velvet paws...

--
Alex
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02