Subject: | |
From: | |
Reply To: | |
Date: | Wed, 14 May 2014 21:00:47 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Generally, you need to remove the "destroyed" agents from ALL data
structures where thy might be referenced-- grids, bags, ArrayLists, and so
on. Only then will the Java garbage collector remove them from memory.
Russ
On 5/14/14 8:43 PM, "Sean Luke" <[log in to unmask]> wrote:
> 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.
>
> Sean
>
> On May 14, 2014, at 11:30 PM, Francesco Pizzitutti
> <[log in to unmask]> wrote:
>
>> Hi,
>>
>> 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?
>>
>> Francesco
|
|
|