• Cases
  • We conducted an expert evaluation of the app for analyzing memory leaks and GDI resource usage

We conducted an expert evaluation of the app for analyzing memory leaks and GDI resource usage

  • Industry

    IT

  • Project type

    Web

Description

Our client provides its own software solution for pharmacies – a system for the primary management of a work process in independent pharmacies and pharmacy chains. After the migration of the app from Delphi 2007 to Delphi 10.3, there appeared some issues during its intensive usage. Amid user interaction with the app, GDI resources utilized by the software achieve the maximum level of 10000 GDI resources for a process. As a result, the app can’t create additional management elements and it crashes with different error reports. The app can increase the GDI limit up to 65K but it can only postpone the moment of app crash but won’t solve the problem.

The problem doesn’t appear in the Delphi 2007 app version though the code in many parts of both versions is identical. After the migration to Delphi 10.3 one of the key updates was the transformation of String into AnsiString in those places where it was required. It was the most serious change. Another important update was the replacement of some components with their Unicode version.

The client turned to us with a request to conduct the evaluation of the existing code and provide recommendations on the ways to enhance the app and solve the problems.

Client`s pain and concern

After the migration of our application from Delphi 2007 to Delphi 10.3 we started noticing problems during its active usage. The GDI resources that are utilized by the app reach the maximum level of 10 000 GDI resources for one process. It leads to abnormal app crashes with different error reports.

Project Team size

  • Project Manager
  • Business Analyst
  • 2 Developers
Project Team size

Solutions

Visual review of the source code of the program for detecting forms and blocks that caused problems

The Softacom team had to look for the created objects in each module and check the places for freeing memory. We paid a lot of attention to implicit object creation. The results were added to a single table.

Measuring the app GDI resources with the help of such tools as GDI_View, Process Monitor, and WinSpy++

The team created an algorithm for detecting memory leaks by performing various actions in the program such as opening and closing forms, calling different menu options, and running operations for reading and recording. The algorithm was applied several times. The results were included in the table.

Review and comparison of the app versions written with Delphi 2007 and Delphi 10.3 for detecting problems with GDI

Our experts used such tools as FastMM and TaskManager. We also conducted a visual code analysis for identifying existing vulnerabilities in the program.

Collection of app statistic data: the number and size of modules, the number of active forms, as well as the used components and applied libraries

The team also conducted the preliminary evaluation of both software versions for identifying general memory leaks and measuring loads on GDI.

Identifying memory leaks

Checking the source code in suspicious modules.

The key goals of these steps were the identification of the basic line for making decisions in the future and the elaboration of potential solutions that could be included in a final document. The goal of introducing this document was to formalize the current code state in one place and describe the existing problems in Delphi code, problems with GDI, memory leaks, as well as conclusions, and results of the Delphi 10.3 app version performance. The information in the document described all the evaluation results and became a basic plan for further steps aimed at solving the considered problems. It included the following points:

- The description of the usage of GDI processors in problematic forms;

- The description of the GDI problem nature and places where such problems appeared;

- The description of problematic forms and blocks;

- The description of the current code state and possible code improvements;

- The list of problematic components that could be improved and changed.

In the process of studying the software, we detected a row of problems that could indicate the necessity of code refactoring and optimization. Some code peculiarities make its maintenance more complicated and make troubleshooting more time-consuming. In some places, the risk of program failure is growing which can be indirectly related to the issues that are being fixed.

Solutions

Technologies

  • Used in the project
  • Delphi Delphi
  • VCL VCL
  • CrystalReports CrystalReports

Outcome

  • Thanks to our deep app analysis, we’ve identified problematic forms that could lead to leaks, as well as found other code parts that could be improved for increasing the app performance.
  • As a result, the client’s team could eliminate the source of the problem and fix the issues that they hadn’t noticed before the app analysis.

Subscribe to our newsletter and get amazing content right in your inbox.

You can unsubscribe from the newsletter at any time

This field is required
This field is required Invalid email address

You're almost there...

A confirmation was sent to your email

confirm your subscription, make sure to check
your promotions/spam folder