Today working on a model that’s been in under development for a while and I felt that the model was rather sluggish compared to the last time I was working with it. I did some profiling and found a couple of nice speed ups in rendering the model. But also while digging into this I noted on the MacOS activity monitor that my model was using about 4.8GB RAM which… well, on a Mac Air (not my only machine) it’s a lot!
Out of interest, I went back to the last version of substantially the same model that ran in 6.4.x to see how much memory that was using, and it was less than half that.
So I’m just wondering is there any reason that such large increases in memory usage would be expected from the latest version? Perhaps the ARM-native version?
This isn’t a bug for me, not a show-stopper, just interested to know more, and to hear if anyone else is experiencing anything similar.
Thank you for reporting this issue! It’s certainly not expected that 7.x versions would use that much more memory than older versions. If anything, I would expect the ARM-native version to use less memory, since it no longer needs to run with Rosetta as a wrapper. There could be something specific in the model you were testing that somehow ended up with higher memory usage, so if it’s possible, it would be helpful if you could send a copy of that model for us to test. If it’s a specific component that was unintentionally changed since 6.4, there’s a chance that we could fix the problem before the next release. If you aren’t able to share your model, could you give a general idea of what you were doing, eg. BehaviorSpace, large number of patches or turtles, etc.? Also, which exact version are you using?
I assembled the model and its input files in a zip file to respond to this message, but before sending it thought I’d just double-check the behaviour, and now I can’t replicate it! Usage gets up to about 2GB which is a lot, but nothing like I was seeing the other day. Higher than in 6.4, but not ridiculously so. Perhaps something about the complicated way the Apple ARM machine’s handle memory if they’re juggling a lot of tasks?
It’s a complex model - about 70,000 patches and 2000+ turtles, so not unexpected that it might stress a small laptop. Also using the gis, matrix, csv, network, table, palette extensions, and creating a ton of agents at startup only to destroy them (they are used to partition the model space into connected subregions efficiently) - so yeah, a lot going on!
I made the model snappier by stopping it from rendering change so often and am happy that it’s running more smoothly now.
I’ll keep the issue under observation and if it shows up again I’ll check in and provide a copy. I can provide a copy now if you’d like, but would prefer to share by email rather than in this forum. Let me know where to send.
Hmm, interesting. Given the large difference in memory usage, I think the most likely explanation is that in the previous case, Java had not yet run garbage collection when you got the 4GB number. Java is notorious for lazy garbage collection, meaning that it typically only frees up unused memory when it absolutely needs to. This can have an especially noticeable effect if you do things like creating a bunch of agents and immediately getting rid of them, as you described doing in this model. Although likely, this is difficult to confirm, so feel free to send your model to [email protected] and we can take a look at it.