Page 1 of 1

Possible Memory leak?

Posted: Tue 20 Dec 2016 02:46
by sugi
Hi,

I am experienced memory leak when using TIBCConnection. Memory consumption could reach, possibly at least minimum 4x bigger then it should be.

Here are the simple codes to demonstrate the case. TIBCConnection use default properties, database : Firebird 3.01 x64 SS

Code: Select all

   bool NotOpen = true;
   while(NotOpen)
   {
      try
      {
         ConnTrs->Close();
         ConnTrs->Open();
         NotOpen = false;
      }
      catch(...){};
   }
Run those codes for about 3-4 minutes, when Firebird service not started , stop the code, then run again when Firebird service already started, compared its memory consumption.

Re: Possible Memory leak?

Posted: Wed 21 Dec 2016 10:47
by ViktorV
In order for us to give you a detailed answer, please provide the detailed problem description:
- specify, please what you mean by the phrase "memory leak". Does it mean that the memory is not released when the application is closed?
- what is the reason of the statement about the memory consumption increase in 4 times and how you calculated the reference value?
- memory consumption increase occurs when the application works constantly or stops at a certain value?

Re: Possible Memory leak?

Posted: Wed 21 Dec 2016 12:05
by sugi
ViktorV wrote:In order for us to give you a detailed answer, please provide the detailed problem description:
- specify, please what you mean by the phrase "memory leak". Does it mean that the memory is not released when the application is closed?
1) Run application when Firebird service not started, it consumed 25K RAM
2) Run application run when Firebird service already started, it consumed about 4K
ViktorV wrote: - what is the reason of the statement about the memory consumption increase in 4 times and how you calculated the reference value?
1) run application when Firebird service not started
2) looked at memory consumption via Windows Task Manager
3) close application
4) start Firebird service
5) run again application
6) looked again memory consumption via Windows Task Manager
ViktorV wrote: - memory consumption increase occurs when the application works constantly or stops at a certain value?
it stops at certain value

Re: Possible Memory leak?

Posted: Wed 21 Dec 2016 13:21
by ViktorV
We investigated the problem and did not detect the specified memory consumption.
When investigating we obtained the following results:
- there is a slight memory consumption increase when running your code if Firebird service is stopped. But this increase is correct, as to establish a connection to a server even when the server is unavailable, necessary resources are allocated.
- when a connection to the server is established some additional resources are also allocated. That means that memory consumption is a bit higher than when Firebird is stopped.
By default, the standard Task Manager displays in the Memory - Private Working Set column the amount of memory used by the process partially. To know the whole memory consumption by the process, you should monitor the value displayed in the Memory - Working Set column.
You can enable the Memory - Working Set column display by using the View-Select Columns menu item of the Task Manager.
Please try to perform the above steps to monitor the memory using the value displayed in the Memory - Working Set column of the Task Manager, and inform us about the result.

Re: Possible Memory leak?

Posted: Tue 27 Dec 2016 07:18
by sugi
Here are the result :
1) When Firebird service starts a few minutes after app start :
- Working set (memory) 74068K
- Memory (private working) 67420 K

2) When Firebird service already started when app start :
- Working set (memory) 10624K
- Memory (private working) 4752K

Re: Possible Memory leak?

Posted: Tue 27 Dec 2016 08:47
by ViktorV
As we have already mentioned we could not detect the specified memory usage.
In the first case we obtained the following results:
- Working set (memory) 12324K
- Memory (private working) 2240K
In the second one:
- Working set (memory) 12156K
- Memory (private working) 2208K
These are correct results because in the first case, some small additional resources are allocated to handle a connection failure to the server.
Therefore, please compose a complete sample demonstrating the specified behavior, including scripts to create and fill the database objects and the used client library and send it using the contact form https://www.devart.com/company/contactform.html, so we can give you a more detailed answer. Also, specify the used IDE version.