[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] Particle removal and deactivation

Ben Webb wrote:
Daniel Russel wrote:
I can't find the imp-commit email for some reason. Anyway, there was a recent patch (581) changing a model::remove_particle to deactivating the particle. This change is wrong as the particles are currently reference counted in C++ and removing the particle from the model should do the right thing assuming there are no python references hanging around. If it does not, it is a bug in kernel code which should be fixed.

The testcase tried to use a Python reference to a particle which had already been deleted. This clearly won't work, which is why I fixed it in the patch. Running that testcase through valgrind clearly showed access to freed memory, as I wrote in the svn log. By all means, submit a patch which fixes the bug if you like. But the reference counting clearly does not work with Python right now, and I don't have time to fix this the "right" way.
No. The nbl should have been keeping the particle alive until the evaluate call (and the evaluate call will have memory issues if the memory is no longer valid since it needs to check if the particle is active or not). So there are probably deeper bugs.