GraphUpdateObject Pooling


#1

Hi,

I am generating a lot of garbage from GraphUpdateObjects and have been trying to pool them.

Due to the fact that they are not immediately used (especially when “Batch Graph Updates” is switched on) I was getting a lot of problems where I believe I was modifying them before plugin was done with them.

I tried quite a few workarounds, but in the end I added a “FinishedApplying” bool to the GraphUpdateObejct class itself (default to true). I set this to false when I set up my GUO, it then gets set to true inside void IUpdatableGraph.UpdateArea (GraphUpdateObject o) of GridGenerator.cs, which I believe is when all the work with that GUO is finished? I can then decide whether a GUO can be re-used based on this flag.

This seems to let me pool them correctly without any errors, but I just wanted to check that the point I am setting my flag is indeed the end of the GUO being used by your code?

Perhaps there is a better way of doing this that you can add to the pathfinding engine itself? I am always loathed to make changes to a Plugin as it can make updates a pain.

Thanks a lot,

Niall


#2

Hi again, any thoughts on this?