Jump to content

David Heffernan

Members
  • Content Count

    3536
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by David Heffernan


  1. 34 minutes ago, Pierre le Riche said:

    I believe VirtualAlloc is smart enough to provide memory from the NUMA node closest to the CPU the thread is running on

    I would expect so, but I don't know for sure. I do know that when using HeapCreate / HeapAlloc this is true, but that's no use to you.

     

    I do have a NUMA machine to hand and would be happy to run some tests on it if that would be useful for you.

    • Like 1

  2. 15 minutes ago, Günther Schoch said:

    Well, during the design phase of FastMM5 this feature was discussed but not (yet) implemented. The background was:

    a) a lot of the software is now running on large AWS nodes or similar virtual severs. There the optimization via NUMA is rather a special case

    b) modern processors as the AMD EPYC https://www.nextplatform.com/2019/08/15/a-deep-dive-into-amds-rome-epyc-architecture/ have internal optimization strategies 

    But we are open to everything that makes the FastMM5 performance significantly better.

    regards Günther (Günther Schoch, gs-soft AG = we sponsored FastMM5)

    My question was based on my own experience running multithreaded floating point software on NUMA machines, an issue that was live for me maybe three years ago.

     

    My problem was that most memory managers allocate out of a shared pool, but that cross node memory access is much more expensive than within node memory access.  I didn't find any Delphi memory managers that were both robust and able to allocate memory local to the node on which the calling thread was executing.  IIRC, allocators such as that of TBB and others used in the C++ world were able to do this.

     

    My application is a little different to more mainstream Delphi applications however.  I understand that fastmm targets usage with frequent allocation of relatively small objects.  In my application I preallocate wherever possible and avoid allocation in any hotspot.  So my goal could just be boiled down to achieving affinity to the local node.

     

    In the end I wrote my own memory allocator on top of HeapCreate / HeapAlloc etc.  The strategy is the each NUMA node has its own private heap (allocated by a call to HeapCreate).  Each allocation is performed on the heap associated with the calling thread's node.  I'm not in any way suggesting that such a simple strategy would be appropriate for fastmm.

     

    The interesting thing that I observed is that raw heap allocation / deallocation performance was never a problem for my app, because of the efforts we took to avoid allocation in hotspots.  Likewise for thread contention, for the same reasons.  The issue was that memory access speeds in my app is a key performance factor.  And cross node access has dire performance.

    • Like 1

  3. You asked the same question on SO: https://stackoverflow.com/questions/61505887/thread-programming-without-sleep-or-waitfor-events

     

    It was closed there because it lacked focus.  You seem to be wanting advice to a level of detail that far outstrips the level of detail used to specify your problem, and your current solution.  In my view you are unlikely to be anything much out of a question asked the way you did.  I recommend that you step back and provide a lot more detail and background.  That will give you more hope of getting relevant advice.

    • Like 2

  4. 8 hours ago, Mike Torrettinni said:

    Yes, I guess this is how scroll messaging works, when pressing on scroll button:

    1. Scroll line down (button pressed)

    2. End scroll (button released)

     

    Which is probably fine for most applications, but I synchronize 3 or 4 scroll boxes at the same time and it was executing custom scroll 2x. So, annoying for anything that is customized, but I guess it is the right way.

     

    So, now I have:

     

    
    procedure TScrollBox.WMVScroll(var Message: TWMVScroll);
    begin
      inherited;
      if Message.ScrollCode <> SB_ENDSCROLL then
        if Assigned(FOnScrollVert) then  FOnScrollVert(Self);
    end;

     

    Until better solution comes along 🙂

    This looks badly wrong to me. What problem are you trying to fix?


  5. 30 minutes ago, Tommi Prami said:

    I clarify little.

    what mean by Default, not the Delphi default but MY DEFAULT what it ever would be. in current context.

    I also was thinking of using enumerated type or so, but it is not that official, Delphi defined way. Seems that this has not been thought at all while implementing this. There are ways around this, but seems no way to define some (random) defaulöt method parameter.

     

    -Tee-

    This provides no clarification to me. Now I think I have no idea what you are asking. 

    • Like 1

  6. 38 minutes ago, Tommi Prami said:

    Is there any standard way to pass encoding default

    You can't declare an encoding instance to be a default parameter value because it is not a constant, never mind a true constant. Hence the compiler error. 

     

    So you have to resort to overloaded methods. Declare one method that accepts an encoding parameter. And another that does not. From that second overload call the first passing your chosen default encoding. 

    • Like 1

  7. When the debugger evaluates some variables to display values in the debugger it often leaks memory. This is a defect with the debugger. The code here does not leak. Any reported leaks are due the debugger. 

     

    I see this very often with property getter functions that return strings. The debugger calls the function, creating a new string. But then the debugger fails to destroy the string. Leak. 


  8. 10 minutes ago, Mike Torrettinni said:

    I believe that my first projects accounted for 10% of world-wide AVs 🙂 Though, none of them corrupted any systems, disks, crashes... and no lawyers involved. I would not choose your security measures, but it is interesting approach.

    It is not interesting. 

     

    Also, no guarantee that invalid pointer leads to access violation. Corrupted data is perfectly possible. 


  9. 28 minutes ago, Attila Kovacs said:

    @David Heffernan I'm telling the same. The phrase you quoted was referring to the action "wiping a disk", if a "bug" could cause that, that bug doesn't have to be on purpose.

    There's a huge difference between making an unintended mistake after having done your best not to, and intentionally harming. It's surely not difficult to see. 


  10. 1 hour ago, Anders Melander said:

    I've used both VTune and AQTime with 64-bit projects and I can't recall that I had problems with it.

    What's your experience?

    VTune works well. AQTime was an unmitigated AV fest when I last tried it. 

    • Haha 2
×