Memory dump - NetLogo

12 views
Skip to first unread message

Rafaela Lorena

unread,
Oct 9, 2021, 6:15:33 AM10/9/21
to netlogo-users
Hello all,

Does anyone know if it is possible to clear the memory (memory dump) between a simulation and another simulation in NetLogo 6.2?

Thanks in advance

Wade Schuette

unread,
Oct 9, 2021, 7:49:50 AM10/9/21
to Rafaela Lorena, netlogo-users
I don't know off-hand, but I'm really curious as to what problem you have run into that makes you want to do this. Is the allocated memory increasing with each simulation and you are finally running out?  In which case another possible question would be - How do I allocate more memory to begin with to NetLogo and how do I see moment by moment how much it's using?

Wade

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/CAHs8kB8AY0niJk7-opOGc9iziHGbb3y15d9FAhthFQRL%3DOFZKw%40mail.gmail.com.

Wade Schuette

unread,
Oct 9, 2021, 7:52:20 AM10/9/21
to Rafaela Lorena, netlogo-users

On Sat, Oct 9, 2021 at 5:15 AM Rafaela Lorena <rafael...@gmail.com> wrote:
--

Wade Schuette

unread,
Oct 9, 2021, 7:54:17 AM10/9/21
to Rafaela Lorena, netlogo-users
sorry, realized that link was pretty broad. I meant this section

How big can my model be? How many turtles, patches, procedures, buttons, and so on can my model contain?

We have tested NetLogo with models that use hundreds of megabytes of RAM and they work fine. We haven’t tested models that use gigabytes of RAM, though. Theoretically it should work, but you might hit some limits that are inherent in the underlying Java VM and/or operating system (either designed-in limits, or bugs).

The NetLogo engine has no fixed limits on size. By default, though, NetLogo ships with a one-gigabyte ceiling on how much total RAM it can use. If your model exceeds that limit, you’ll get an OutOfMemoryError dialog.

If you are using BehaviorSpace, note that doing runs in parallel will multiply your RAM usage accordingly.

Each platform contains “.cfg” files containing JVM settings. There is one cfg file for each sub-application (NetLogo, NetLogo 3D, HubNet Client, etc.) Although the file location varies by platform, the process for changing it is the same. Locate the section of the file that looks like the following:

[JVMOptions]
# there may be one or more lines, leave them unchanged
-Xmx1024m
# there may be one or more lines, leave them unchanged

Modify the value immediately following -Xmx, changing it to the amount of space you need, save the file, and restart NetLogo. Platform specific notes follow:

  • Windows: The file will typically be in C:\Program Files\NetLogo 6.2.0\app, unless you are running 32 bit NetLogo on a 64 bit Windows, then it will be in C:\Program Files (x86)\NetLogo 6.2.0\app.
  • Mac OS X: The file for NetLogo will be located at: /Application/NetLogo 6.2.0/NetLogo 6.2.0.app/Contents/Java/NetLogo.cfg For NetLogo 3D and the other applications, you will find the file in the corresponding location for each application package. You can reach the cfg file by control-clicking the application in the Finder and choosing “Show Package Contents” from the popup menu.

    Please note that depending on your version of Mac OS X, changing the cfg file may break application signing. If this happens, follow Apple’s directions on this page to temporarily allow apps from “Anywhere”, run NetLogo once, then restore the setting to “Mac App Store and Identified Developers”.

  • Other: The cfg files will be located in the netlogo-6.2.0/app folder after untarring.

By default, Mac builds of NetLogo bundle a 64-bit JVM, which should be able to make use of as much memory as the lesser of available system memory and the value following -Xmx. Windows and Linux will bundle a 32-bit or 64-bit JVM, depending on which version you have downloaded. It is recommended that you install 64-bit NetLogo on all 64-bit operating systems for best performance.



On Sat, Oct 9, 2021 at 5:15 AM Rafaela Lorena <rafael...@gmail.com> wrote:
--

Wade Schuette

unread,
Oct 9, 2021, 7:58:23 AM10/9/21
to Rafaela Lorena, netlogo-users
As stack overflow answer said if you just need "clear-all", that's answered.
However I see that someone else noticed a memory leak in Netlogo and never got an answer



On Sat, Oct 9, 2021 at 5:15 AM Rafaela Lorena <rafael...@gmail.com> wrote:
--

Michael Tamillow

unread,
Oct 9, 2021, 11:36:06 AM10/9/21
to Wade Schuette, Rafaela Lorena, netlogo-users
This comes off as a general inquiry into Netlogo, but I’m curious what inspired it.

Chances are pretty good that there is something fishy in your model if you are blaming the memory management on Netlogo and hoping to monkey patch it.

Sent from my iPhone

On Oct 9, 2021, at 6:58 AM, Wade Schuette <wade.s...@gmail.com> wrote:



Vidushi Patel

unread,
Oct 9, 2021, 9:13:19 PM10/9/21
to Michael Tamillow, Wade Schuette, Rafaela Lorena, netlogo-users
I agree with Michael’s point about something fishy in the model. 

I had similar issue for my model where I started thinking that there is a memory leak with each run. My model uses multiple GIS files in initialisation as well as each tick. I increased processing memory for NetLogo 4 times and the issue still persisted. Finally, I checked my code line by line and found out a piece of code that was causing the issue. 

Maybe it’s worth checking your code. Suggestions in this paper https://www.jasss.org/20/1/3.html helped me a lot. 

On 9 Oct 2021, at 11:36 pm, Michael Tamillow <mikaelta...@gmail.com> wrote:

This comes off as a general inquiry into Netlogo, but I’m curious what inspired it.

John Chen

unread,
Oct 9, 2021, 10:33:06 PM10/9/21
to Vidushi Patel, Michael Tamillow, Wade Schuette, Rafaela Lorena, netlogo-users
What kind of code could cause potential memory leak/allocation issues, especially between model runs? I am really interested to know.

Also, I wonder if there is a discrepancy between NetLogo Desktop and NetLogo Web.

Vidushi Patel <vidus...@gmail.com> 于2021年10月9日周六 下午8:13写道:

Michael Tamillow

unread,
Oct 10, 2021, 8:46:09 AM10/10/21
to John Chen, Vidushi Patel, Wade Schuette, Rafaela Lorena, netlogo-users
Infinite recursions. 

Sent from my iPhone

On Oct 9, 2021, at 9:33 PM, John Chen <yuehanc...@u.northwestern.edu> wrote:


Reply all
Reply to author
Forward
0 new messages