Page 1 of 1

Memory Management

Posted: Mon 24 May 2021 08:42
by claudio.piffer
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!

Re: Memory Management

Posted: Mon 24 May 2021 09:11
by claudio.piffer
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

Re: Memory Management

Posted: Wed 09 Jun 2021 06:37
by claudio.piffer
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

Re: Memory Management

Posted: Wed 09 Jun 2021 23:16
by claudio.piffer
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;

Re: Memory Management

Posted: Thu 10 Jun 2021 13:24
by MaximG
Thank you for the information. We will investigate the described issue and let you know the results shortly.