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

only store G4TouchableHandle if visualization is enabled #206

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

ManuelHu
Copy link
Collaborator

fixes #205

@ManuelHu
Copy link
Collaborator Author

ManuelHu commented Jan 6, 2025

@EricMEsch could you test if this PR fixes the memory leak you observed?

@EricMEsch
Copy link
Collaborator

It does not seem to work. I tested and the memory consumption is still the same. I added a print statement inside of if(G4VVisManager::GetConcreteInstance() and it seems that if statement is true, even if i run in batch mode. If I run e.g. example 03-optics i will still see the print.

@EricMEsch
Copy link
Collaborator

EricMEsch commented Jan 7, 2025

This is probably because in RMGManager::Initialize() the fG4VisManager is Initialized in any case. It might be a solution to just add a variable that will be set upon entering RMGManager::StartInteractiveSession()?

Edit: Nevermind, that variable already exists (fInteractive), there is just no getter for this variable yet

@ManuelHu
Copy link
Collaborator Author

ManuelHu commented Jan 7, 2025

oh no, but fInteractive does not really help here. Visualization can also be used in batch files... (i.e. running a simulation and exporting an image file, like in our CI tests here). I will try some things to get the actual vis state from the manager...

@ManuelHu
Copy link
Collaborator Author

ManuelHu commented Jan 8, 2025

please test again. the updated patch is now checking for the actual attached scene handler, and not just the manager.

@EricMEsch
Copy link
Collaborator

Yes, now it works. Went from 24 GB memory consumption to 6 GB for my Simulations, that consists of a lot of optical photons each event.

@gipert gipert merged commit 4666929 into legend-exp:main Jan 9, 2025
5 checks passed
@ManuelHu ManuelHu deleted the optical-touchable branch January 9, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory consumption due to G4TouchableHandle in RMGOpticalDetectorHit
3 participants