Hi,
how did you diagnose the memory leak? Just the memory usage going up? When you enable plotting, ViewDrift stores internally the coordinates of all points along the drift lines, so if you have many, many drift lines you may indeed have a significant memory consumption.
Hi,
sorry for the delay in getting back to you! No, I’m afraid I’ve not been able to reproduce the issue. I’ve used a slightly modified version of your example which I’ve attached. In your original example you had two places where you called EnablePlotting; which could explain why you saw an increase in memory usage with time even when you thought you had switched off plotting the drift lines.
When I switch off drift line visualisation (plotDrift = false), the memory consumption does not increase with the number of tracks simulated.
This isn’t directly related to you question, but I’ve also added a line (SetDistanceSteps) to set the target step size in AvalancheMC explicitly (to 0.1 mm, but this is something you might want to play with), because the default was giving strange results.
Also, again not directly related to your question, but just to point out a potential misunderstanding: AvalancheMC::DriftElectron simulates the drift of a single electron but does not simulate the secondaries produced in the avalanche. This might not be what you want.
@hschindl, thanks for your patient reply to my question, when using the code in the file of test.C, the error occured with the code: Sensor sensor(&cmp); it seems no proper constructor function. and when using codes: Sensor sensor; sensor.AddComponent(&cmp); the application can run, and the memory consumption problem is still exist. so something is wrong with my Garfield problem. by the way, AvalancheMicroscopic::DriftElectron can produced in the avalanche?