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

High memory consumption #109

Open
Margera opened this issue Jan 10, 2024 · 1 comment
Open

High memory consumption #109

Margera opened this issue Jan 10, 2024 · 1 comment

Comments

@Margera
Copy link

Margera commented Jan 10, 2024

In some tests I noticed a high increase in RAM memory, where it goes up and down to a certain "minimum limit" this minimum limit increases with the amount of logs sent.

In one example, when opening the application, it starts with around 10mb and with each batch of 500k logs, consumption increases to 500mb and drops to 20mb, with each new upload, this minimum increases. In the test, sending many logs, I noticed a significant increase, easily reaching the minimum of 800mb.

Looking at the "Quick.Logger.pas" code with the application in debug, I can see in the "TThreadProviderLog.Destroy destructor" in "fLogQueue.Free" that the memory is freed at that moment when the program ends.

While debugging I also realized that there may be a problem with the queue. In the image, we can see the "fQueue" items, we have 10 items. In the first log ever sent, index 0, the object is "cleaned", but not removed/deleted. At index 1 we have a new log about to be sent, and the other positions are null.

Could there be a memory consumption problem due to these items that are sent but not completely deleted from the fQueue?

Captura de tela 2024-01-10 120912

@exilon
Copy link
Owner

exilon commented Jan 30, 2024

QuickLogger internally uses techniques similar to TList. To avoid continuous memory reallocations, the size of arrays is increased, not one by one, but by a larger amount, up to a certain size, to accommodate new items. It's a performance-related consideration. The "empty spaces" you see are pointers to objects. If they are set to nil, the memory consumption is minimal and should not be affected. Nevertheless, I will review the code to ensure that no bugs have inadvertently crept in.

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