# System for saving objects

**URL:** <https://discourse.processing.org/t/system-for-saving-objects/25935>\
**Category:** Coding Questions\
**Created:** [December 3, 2020, 4:59pm UTC](https://discourse.processing.org/t/system-for-saving-objects/25935 "2020-12-03T16:59:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [December 3, 2020, 10:54pm UTC](https://discourse.processing.org/t/system-for-saving-objects/25935/6 "2020-12-03T22:54:00Z")

</div>

Ok thanks,

This is probably this problem explained by Sojamo :

> this is probably a concurrency issue. there are 2 threads running, the sketch itself and the ControlFrame.
> 
> Without having access to the code of a running example that demonstrates the behaviour you are encountering it is hard for me to tell if this is a controlp5 issue or a sketch issue. However if you modify an array in your main sketch from the controlFrame, a concurrency issue is very likely.
> 
> Using a [CopyOnWriteArrayList](https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CopyOnWriteArrayList.html) instead of ArrayList might solve that issue.

([ControlFrame issues · Issue #138 · sojamo/controlp5 · GitHub](https://github.com/sojamo/controlp5/issues/138#issuecomment-424945219))

And this related issue might help, this is not related to Gson :

> [@Clearing an ArrayList](https://discourse.processing.org/t/clearing-an-arraylist/3697/11):
>

---

_[View the full topic](https://discourse.processing.org/t/system-for-saving-objects/25935)._
