Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastMM4 states there are memory leaks #111

Open
vesnx opened this issue Mar 14, 2024 · 4 comments
Open

FastMM4 states there are memory leaks #111

vesnx opened this issue Mar 14, 2024 · 4 comments

Comments

@vesnx
Copy link

vesnx commented Mar 14, 2024

Hi,

Mybe I am doing it wrong but I am trying to have the logs flush and so I made a method:

implementation

uses
  Quick.Logger,
  Quick.Logger.Provider.Files,
  Quick.Logger.ExceptionHook;

procedure FinalizeLogger; stdcall;
var
  count: Integer;
begin
  Log('Logger shutdown', etInfo);
  // Force the logger to flush any buffered messages.
  if Assigned(Logger) then
  begin
    count := Logger.QueueCount;
    Log('There are %d log items in queue.', [count], etInfo);
  end;

  if Assigned(GlobalLogFileProvider) then
  begin
    GlobalLogFileProvider.Drain;
    GlobalLogFileProvider.Stop;
  end;
end;

procedure FinalizeLogger; stdcall;
var
  count: Integer;
begin
  Log('Logger shutdown', etInfo);
  // Force the logger to flush any buffered messages.
  if Assigned(Logger) then
  begin
    count := Logger.QueueCount;
    Log('There are %d log items in queue.', [count], etInfo);
  end;

  if Assigned(GlobalLogFileProvider) then
  begin
    GlobalLogFileProvider.Drain;
    GlobalLogFileProvider.Stop;
  end;

end;

In my test I initialize and Finalize the log to make sure i capture it all:

  [TestFixture]
  EncyptionTest = class
  public
      [Setup]
    procedure Setup;
    [TearDown]
    procedure TearDown;
    [Test]
    procedure DeriveKeyFromPasswordTest;
    [Test]
    procedure DeriveSameKeyFromPasswordTest;
    [Test]
    procedure RoundTripTest;
  end;

procedure EncyptionTest.Setup;
begin
        InitializeLogger;
end;

procedure EncyptionTest.TearDown;
begin
  FinalizeLogger;
end;

When the test ends I get a warning box
image

I enabled the detail logs and attached them

WalterNativeTests_MemoryManager_EventLog.txt

Am I doing something wrong, what am I missing?

@exilon
Copy link
Owner

exilon commented Oct 8, 2024

Are you using it in a dll?

@vesnx
Copy link
Author

vesnx commented Oct 9, 2024

Yes

@exilon
Copy link
Owner

exilon commented Oct 9, 2024

Could you show me InitializeLogger function code?

@vesnx
Copy link
Author

vesnx commented Oct 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants