The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,403 other followers

Archive for the ‘Delphi’ Category

Reading files that are locked by other references: c# – Notepad beats them all? – Stack Overflow

Posted by jpluimers on 2018/08/16

Cool feature borrowed from Notepad, which can read files locked by other references (for instance a process having the handle open): [WayBackc# – Notepad beats them all? – Stack Overflow.

The example from the answer is in .NET, but can be used in a native environment as well (Notepad is a native application).

Notepad reads files by first mapping them into memory, rather than using the “usual” file reading mechanisms presumably used by the other editors you tried. This method allows reading of files even if they have an exclusive range-based locks.

You can achieve the same in C# with something along the lines of:

using (var f = new FileStream(processIdPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var m = MemoryMappedFile.CreateFromFile(f, null, 0, MemoryMappedFileAccess.Read, null, HandleInheritability.None, true))
using (var s = m.CreateViewStream(0, 0, MemoryMappedFileAccess.Read))
using (var r = new StreamReader(s))
{
    var l = r.ReadToEnd();
    Console.WriteLine(l);
}

Via: [WayBack] Maintaining Notepad is not a full-time job, but it’s not an empty job either – The Old New Thing

–jeroen

Posted in .NET, Delphi, Development, Software Development | Leave a Comment »

Have NoMessageBoxes depend on a global boolean · Issue #58 · pleriche/FastMM4 · GitHub

Posted by jpluimers on 2018/08/16

Reminder to self: [WayBackHave NoMessageBoxes depend on a global boolean · Issue #58 · pleriche/FastMM4 · GitHub

–jeroen

Posted in Delphi, Development, FastMM, Software Development | Leave a Comment »

Work around for running out of memory when building multiple projects in Delphi < 10.2

Posted by jpluimers on 2018/08/16

I found out this is a problem until at least Delphi 10.1 Berlin, but my original question was for XE8:

Is there any tool that clears the Delphi memory overhead when a “build all” switches to the next project in a project group?

XE8 constantly runs out of memory with large project groups as the memory usage keeps increasing for each project it builds in the group.

There are actually two answers:

Uwe Raabe:  Have you tried with Use MSBuild checked for each project?

Jeroen Wiert Pluimers: +Uwe Raabe Much better. Much slower too (:

and:

Torbjörn Olsson: Have you tried DDevExtensions?
There is a setting named “Release compiler unit cache before compiling”

I’ve opted for the [Archive.is] DDevExtensions; I thought this VM had it installed, but apparently I forgot installing it as [Archive.is] IDE FixPack by the same author was installed.

This is how you configure DDevExtensions:

  1. Run Delphi
  2. Choose menu “Tools”, submenu “DDevExtensions Options…”
  3. In the dialog, select “Compilation” in the list on the left
  4. Ensure “Release compiler unit cache of other projects before compiling” is checked
  5. Confirm any changes

Source: [WayBackIs there any tool that clears the Delphi memory overhead when a “build all” s…

In the comparison below:

  • watch the scale of the graphs
  • observe that DDevExtensions uses about the same memory as msbuild, but builds much faster
With "Use MSBuild externally to compile"

With “Use MSBuild externally to compile”

Regular "Build all"

Regular “Build all”

With DDevExtensions

With DDevExtensions

 

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

A success story – kudos to ScaleMM, +André Mussche… – Ondrej Kelle – Google+

Posted by jpluimers on 2018/08/15

Though no maintenance for over 2 years, it ScaleMM seems among the fastest of Delphi memory managers: [WayBack] GitHub – andremussche/scalemm: Fast scaling memory manager for Delphi

Full story via [WayBackA success story – kudos to ScaleMM, +André Mussche… – Ondrej Kelle – Google+ at [WayBack] just tried Scaled MM – cut the time for 100k down from 51 minutes to 40 minutes. That’s with 18 (9+9) cores allocated to the app and 2 to everything else. Wow, allocating 8 + 8 and the time drops even more… – Russell Weetch

Two lessons on multi-threading here:

  • use a memory manager that copes well with threads
  • do not allocate more busy threads than available (hyper-threaded) cores

Some history (as ScaleMM, TopMM and FastMM seem to be related):

  • A bit of history here: at the time we had the mm contest. Not many people had access to 8 cores+, we had…. Andre and Ivo were both colleagues of mine at that point, although working for different companies. We needed (stock trading, Ivo and me) something to scale and Ivo wrote topmm, which still performs better on multi-cores than fastmm and has less assembler code. Andre improved on Ivo’s concepts and yes, it really outperforms fastmm on multi-cores today.
    It also out-performs most C family provided mm’s. Note I was not massively involved, but both Ivo and Andre were. And both did a proper job. So KUDOS to them.
    Note these (fastmm and topmm) were written with multi-core in mind. The practical results at the time were often under-estimated, because few people had access to the real hardware. Most of us running two cores at most. Nice to see that the concept those two programmers pursued still pays dividend in 2018!
  • Read: ScaleMM and TopMM and FastMM… Keyboard left me..
    (I wrote COMMM as a joke..!).
  • [WayBack] TopMemory v3.55. High Performance. Fully Scalable. Free. Memory Manager. for. Delphi – PDF
  • [WayBack] FPC Anagrams

–jeroen

Posted in Delphi, Development, FastMM, Software Development | Leave a Comment »

zlib win32/i386/x86 and win64/x64_86 builds for Windows

Posted by jpluimers on 2018/08/15

In the past, the DLL for zlib was called zlib.dll, but as of a few years back it is called zlib1.dll as it switched to static linking. There are may obscure download sites for zlib1.dll, but the master site is referenced from these documents:

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: