<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with maxmemory() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=maxmemory%28%29</link>
      <pubDate>Sun, 08 Aug 2021 17:51:02 +0000</pubDate>
         <description>Tagged with maxmemory() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedmaxmemory%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Increasing maximum available memory testing. How to get better results?</title>
      <link>https://forum.processing.org/two/discussion/28047/increasing-maximum-available-memory-testing-how-to-get-better-results</link>
      <pubDate>Fri, 08 Jun 2018 03:03:32 +0000</pubDate>
      <dc:creator>bontempos</dc:creator>
      <guid isPermaLink="false">28047@/two/discussions</guid>
      <description><![CDATA[<p>This is a  i7-8700, 32Gb of RAM, NVIDIA GeForce GTX 1080, running Windows 10 and Java 8 (171) installed and heap memory set to max 32Gb(-Xmx32g) (?) on run parameters.</p>

<p>I think this is not a question about library. However, as experiment, I am running an example from <strong>box2D library for processing</strong> named <strong>Liquidy.pde</strong> where I changed the sketch <code>size</code>to (600,300) and tested 3 renderers (default, <code>JAVA2D</code> and <code>P3D</code>). <code>P2D</code> was way too slow to be considered at this point.
I am printing the total memory, allocated memory, free memory, n of particles, fps in the title of the sketch.
I am also declaring the sketch to run at 60 fps using <code>frameRate(60);</code>
I have tried to <em>increase maximum available memory</em>, but when the option was disabled, I have got a slightly better performance in fps.</p>

<p>When running the sketch, a click of mouse will generate a particle system.
10 clicks would generate an environment with about 1000 particles, and 15 clicks will stay around 1700. See attached picture:
<img src="" alt="" /></p>

<p>With 10 particle systems, each rendered kept sketch running around 60 fps:<code>JAVA2D</code> a little worse than default. <code>P3D</code> performed just a little better.
for 15 particle systems, frame rate will decrease to 15 fps (<code>P3D</code>), 19fps (<code>JAVA2D</code> and default).</p>

<p>Disabling the "increase maximum available memory" in preferences (and restarting?) made default renderer and <code>JAVA2D</code> to perform a little better when running 15 particle systems. From ~20fps, they jumped to 25fps.</p>

<p>I am not running out of memory and I wonder if there is any way to improve the performance of my sketches.
Thanks</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/715/M8AC02EYRNU1.JPG" alt="Capture5" title="Capture5" /></p>
]]></description>
   </item>
   <item>
      <title>out of memory error on loadImage()?</title>
      <link>https://forum.processing.org/two/discussion/26006/out-of-memory-error-on-loadimage</link>
      <pubDate>Wed, 17 Jan 2018 15:25:07 +0000</pubDate>
      <dc:creator>jeffmarc</dc:creator>
      <guid isPermaLink="false">26006@/two/discussions</guid>
      <description><![CDATA[<p>Never have got this before.
Sketch stops after 1000's of iterations in draw loop at a img=loadImage("c:/avssmth/smthimg.png");
statement. 
This loadImage is in a If statement , the condition only happens 4-5 times each draw loop so that should not be the problem.
Are there requirements to unload to free memory back up for subsequent statements that use memory?</p>
]]></description>
   </item>
   <item>
      <title>Monitoring Memory Usage</title>
      <link>https://forum.processing.org/two/discussion/21041/monitoring-memory-usage</link>
      <pubDate>Mon, 27 Feb 2017 20:35:42 +0000</pubDate>
      <dc:creator>hudson_m4000</dc:creator>
      <guid isPermaLink="false">21041@/two/discussions</guid>
      <description><![CDATA[<p>Hi All
I am trying to find a means of monitoring memory usage and ultimately would like to have a background thread that will warn users when an app's memory usage is in danger of reaching the heap limit. I currently use try/catch to deal with out of memory issues but now want to anticipate issues in advance if possible. So far I have the code below that gives me allocated heap size and system memory usage but I cannot find a way to just get heap usage for an app. Is there a straight forward way to do this?
Mark</p>

<pre><code>import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo ;
import android.os.Environment;
import android.content.Context;

Activity activity ;
Context context ; 
MemoryInfo myMemInfo ;
ActivityManager myActivityManager ;
long heapSize ;

void setup() {
  fullScreen(P2D) ;
  activity = this.getActivity();  
  context = activity.getApplicationContext();
  heapSize = Runtime.getRuntime().maxMemory();
  myMemInfo = new MemoryInfo();
  myActivityManager = (ActivityManager) context.getSystemService(activity.ACTIVITY_SERVICE);
  fill(255); // text colour
  textAlign(CENTER, CENTER);
}

void draw() {
  background(0) ;
  displayMemInfo() ;
}// end draw()

void displayMemInfo() {
  myActivityManager.getMemoryInfo(myMemInfo) ;
  text("availMem = " + myMemInfo.availMem/1048576 + "MB" + "\n"
    + "appMemory = " + myActivityManager.getMemoryClass() + "MB" + "\n"
    + "lowMemory =  " + myMemInfo.lowMemory + "\n"
    + "threshold =  " + myMemInfo.threshold/1048576 + "MB" + "\n"
    + "heapSize = " + heapSize/1048576 + "MB" + "\n"
    , 0, 0, width, height);
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>