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

Memory leak in interface/tbcore.c #28

Closed
Matthies opened this issue Jul 14, 2018 · 3 comments
Closed

Memory leak in interface/tbcore.c #28

Matthies opened this issue Jul 14, 2018 · 3 comments

Comments

@Matthies
Copy link

Hi.

It seems that the memory allocated for struct PairsData in setup_pairs() is never freed after STOP and even after QUIT. Visible e.g. in Arena GUI that shows the engine consuming more and more memory when probing the TB.
Bug or design?
I would suggest some cleanup function that could be called from the engine.

@syzygy1
Copy link
Owner

syzygy1 commented Jul 14, 2018

After "quit" the engine quits and any allocated memory will be released by the OS no matter what. However, I am reasonably sure that the engine itself releases all memory allocated by the probing code before it actually quits. (OK, that is not part of the interface/tbcore.c code, but that is not a full engine anyway. I am talking about Cfish and Stockfish.)

After "stop" no memory is deallocated because the engine will likely search another position.

The "more and more memory" consumption is not caused by Pairsdata allocations but by more and more of the TB files getting swapped into shared memory (shared with any other engines also accessing the TBs).

@syzygy1
Copy link
Owner

syzygy1 commented Jul 14, 2018

Setting the TB path (SyzygyPath) to "" releases all memory. I think that is part of the interface/* code but I could be mistaken.

@Matthies
Copy link
Author

Indeed setting the SyzygyPath to "" before closing the engine seems to free the allocated PairsData. I will use that. Thanks.

@syzygy1 syzygy1 closed this as completed Jul 15, 2018
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