SparseGrid2D contains objects. It is a representation of space as an infinite grid.
The Schedule contains "agents", which MASON calls Steppables. It is a representation of time.
It sounds like you have added your agent object to both data structures.
If you have stopped an agent in the Schedule (after, I presume, scheduling it repeating), it will eventually drop out of the Schedule. Why would you think it'd also be deleted from the SparseGrid2D? Or any other data structure?
When you call stop() on your stopper, you need to also manually call removeObject() on your SparseGrid2D.
On May 14, 2014, at 11:30 PM, Francesco Pizzitutti <[log in to unmask]> wrote:
> I am creating and destroying a lot of agents during my simulation. They are all
> attached to a SparseGrid2D. For some reason when I stop, with the stopper an
> agent, the reference between the agent and the grid remain active. This leads to
> an increase in the memory use and to a progressive slowdown of the simulation.
> If I periodically reset the sparseGrid2D containing all the agents this remove all
> the references and free memory space. Is this the only solution to this problem?