Memory Management

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
claudio.piffer
Posts: 39
Joined: Mon 30 Apr 2007 07:36

Memory Management

Post by claudio.piffer » Mon 24 May 2021 08:42

Hi,

I have developed a REST service with EntityDAC / UniDAC on Oracle. Since the services are backend to backend I have disabled the cache to be able to control and manage the memory.
I create and destroy the context at each use and the Context has the option Options.Cache.Enable: = False

Despite this, the memory continues to grow. Faced with the destruction of the contex, the memory is not freed. This is a big problem because after a few weeks I am forced to restart the service!

I have also activated the verification of memory leaks and there are none. When the application is closed, everything is closed correctly

I have reported other issues for the past 5 months and have not yet received an answer. At this point if I can't solve this memory problem I'm forced to throw away the project and do it again!

claudio.piffer
Posts: 39
Joined: Mon 30 Apr 2007 07:36

Re: Memory Management

Post by claudio.piffer » Mon 24 May 2021 09:11

This is a very sample code only for test:

Code: Select all

  
var
  LContext: TRISDataContext;
  LOrdersExpression: IVOrdersReportExpression;
  LQuery: ILinqQueryable;
  LOrders: IObjectEnumerable< TVOrdersReport >;

  LStudiesExpression: IVAccessionNumberStudyExpression;
  LStudies: IObjectEnumerable< TVAccessionNumberStudy >;

begin
  for var LIndex: Integer := 0 to 1000 do
  begin
    LContext := TRISDataContext.Create(nil);
    LContext.Options.Cache.Enabled := False;
    LContext.Connection := EntityConnection1;
    try
      LOrdersExpression := LContext.VOrdersReport;
      LQuery := Linq.From(LOrdersExpression)
        .Where(LOrdersExpression.PkReport = 20178662)
        .Select();

      LOrders := LContext.GetEntities< TVOrdersReport >(LQuery);

      LStudiesExpression := LContext.VAccessionNumberStudy;
      LQuery := Linq.From(LStudiesExpression)
        .Where(LStudiesExpression.AccessionNumber = '30150343')
        .Select();

      LStudies := LContext.GetEntities< TVAccessionNumberStudy >(LQuery);

      TThread.Sleep(10);
    finally
      LContext.Free;
    end;
  end;
I execute many times this sample procedure, The initial memory allocated is 16 Mb. After running the code a few times the memory allocated is 60 Mb. As you can see in the code each loop destroys the context and recreates it this does not free the allocated memory

In this video you can see what happens:

https://drive.google.com/file/d/1VGbOQP ... sp=sharing

Could you give me feedback quite urgently

claudio.piffer
Posts: 39
Joined: Mon 30 Apr 2007 07:36

Re: Memory Management

Post by claudio.piffer » Wed 09 Jun 2021 06:37

Hi,

no answer yet?

I need to URGENTsolutions for this problem. Why does the memory keep growing? Is there anything I need to do to avoid this? There are no memory leaks but the memory continues to grow!

Thank you

claudio.piffer
Posts: 39
Joined: Mon 30 Apr 2007 07:36

Re: Memory Management

Post by claudio.piffer » Wed 09 Jun 2021 23:16

Hi

sorry, after some other test, I found this memory leaks

https://drive.google.com/file/d/172gpth ... sp=sharing

i need a solution! This memory leak is giving me a lot of problems.

Another (little) problem is an access violation in this method:

function TUnmappedMetaTypeList.Find(const MetaAttributeDescs: TMetaAttributeDescs): TUnmappedMetaType;

unit EntityDAC.MetaData;

MaximG
Devart Team
Posts: 1672
Joined: Mon 06 Jul 2015 11:34

Re: Memory Management

Post by MaximG » Thu 10 Jun 2021 13:24

Thank you for the information. We will investigate the described issue and let you know the results shortly.

Post Reply