Monday, July 27, 2020

Deleaker: a great tool to find memory leaks

Hi folks,

In the past few weeks I had time to "play" and discover Deleaker: a memory leak detection - memory, GDI, and handles so far.

The creator and maintainer is Artem A. Razin (@deleaker) and this is the official website https://www.deleaker.com/ .

Deleaker Logo

It is very simple to use and understand due to its simplicity and provided tutorials and documentation. 
Deleaker integrates with all major IDEs: Visual Studio, Delphi, C++ Builder, and Qt Creator. 

Hunting and fixing a memory leak could be a difficult task and you cannot approach it without the right tool!

It doesn't matter what type of leaks are occurring, Deleaker will find them all: memory leaks (produced by heap, virtual memory, or OLE allocators etc.), GDI leaks, leaks of Windows USER objects and handles.

I don't want to be repetitive or showing something that is already mentioned from official documentation and online resources, so here a list of useful links to start with Deleaker:

Official Website:
Documentation page:
Video tutorials: 
Here some screenshots:
Deleaker menu in Delphi

Deleaker Window in Delphi


Thursday, May 28, 2020

Delphi 10.4 Sydney is here!

Hi folks,

Delphi 10.4 Sydney has just released and this version comes with a lot of interesting features:

    • New Delphi CodeInsight based on LSP server
    • Custom Managed Records in the Delphi Language
    • New VCL Components, including TEdgeBrowser, and expanded High DPI support for VCL styled applications
    • Enhanced Delphi multi-device platform support integrating newer Apple APIs and supporting the latest Android
    • New LLDB-based debugger for Windows 64-bit for C++
    • Unified installer for online & offline installations
    • GetIt Package Manager Enhancements


            I would like to spend few words around the features that impressed me:


            Code Insight Technology in Delphi 10.4

            From David Millington blog post:

            In 10.4, Code insight features are implemented using a ‘LSP Server’. LSP refers to the Language Server Protocol, which is a standardized way to implement code insight-like features for many languages. An IDE talks to a ‘language server’, which is a small helper app that calculates and generates the information the IDE displays. It does so using a defined protocol, and that’s the language server protocol.

            In other words, the IDE now talks to a helper app when you do something like open a project, or type a keystroke in your file.

            What does it means?
            • Communication with another process is asynchronous
            • The work is done in another process
              • This means all the memory usage for calculating results is no longer in the IDE itself. The IDE has more memory, and the helper app can use its entire memory space dedicated solely to providing results
            • What you see onscreen is what the compiler sees. 
              • If your code compiles, you won’t see any Error Insight errors; conversely, if you do see red squiggly underlines in your code or in the Structure view, your code will not compile.
            • You can get code completion while debugging.

            If you want to know more about it have a look to David Millington post 


            Custom Managed Records 

            This is absolutely the top new language feature of Delphi 10.4!

            Now in 10.4 the Delphi record type supports custom initialization and finalization:

            From Marco Cantù blog post:

            You can declare a record with custom initialization and finalization code regardless of the data type of its fields, and you can write such custom initialization and finalization code.
            This is achieved by adding specific, new operators to the record type (you can have one without the other if you want).
            Below is a simple code snippet:

            type
              TMyRecord = record
                Value: Integer;
                class operator Initialize (out Dest: TMyRecord);
                class operator Finalize(var Dest: TMyRecord);
              end;


            The huge difference between this construction mechanism and what was previously available for records is the automatic invocation. If you write something like the code below, you can invoke both the initializer and the finalizer, and end up with a try-finally block generated by the compiler for your managed record instance.

            Marco Cantù post to know more.


            GetIt Package Manager Enhancements

            GetIt Package Manager Enhancements in Delphi 10.4:
            • the ability of sorting the list of entries by date, seeing the most recent ones on top
            • for each entry you have already installed, the indication that an updated version is available
            • the ability to list all installed entries that have an update available

            Rad studio patches

            A killer feature of the new GeIt is absolutely the ability to use GetIt to distribute patches, with a specific way to alert customers that a patch is available. There is a new section to the Welcome page to indicate when a patch is available and you have not installed it:


            Here a screenshot of Rad Studio patches in action:

            As you can see there is already a patch available through GetIt, this will completely revolutionize the patches distribution!

            Webinar Delphi 10.4

            Here the link for the launch webinar - https://www.youtube.com/watch?v=-rTLEXLVueQ&feature=youtu.be - Enjoy it!


            Other useful resources 


            As you can see from the info above this is a fantastic release! Enjoy it!


            Tuesday, January 8, 2019

            Delphi Flux application architecture

            A good application architecture

            Finding a good application architecture is not easy, but defining an architecture for your application is important: like it or not, every application is going to have an architecture.
            There is no such thing as the Best Architecture, but there is the Best Architecture for your current application! (finish the project on time, with quality, less bugs as possible - no bugs preferred :) - and easy collaboration with your teammates).
            Flux is the application architecture that Facebook uses to structure client-side web applications, is very simple to understand and there is almost no code for it. It's just a way to do things.
            It’s a Clean Architecture so it’s not intended only for web apps, but its features and simplicity will allow us to adapt it very well to other kind of projects.
            I believe Flux is very good choice.

            Delphi Flux

            Base Flux concepts, I created a project on Github Delphi-Flux-Seed. This project is an application skeleton to apply Flux concepts in Delphi applications. You can use it to quickly bootstrap your Delphi application. 

            About Delphi Flux I held a session at CodeRage 2018, so you can watch the replay of that session at this link. Here are the slides of my presentation at CodeRage 2018: