Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For memory leaks in java you might look into packratting. I haven't found a great solution for processing other than running </p> <blockquote> <p>top -s 5</p> </blockquote> <p>(on unix systems) and watching the memory usage until it hangs. I recently worked on a datavis project where I was creating potentially thousands of blitts (in my case images of text to use in opengl) in an ArrayList. Originally I was recreating these arrays on the fly everytime I would load data and it was contributing to a "memory leak".</p> <p>In my case I tried nulling out the object references and calling the garbage collector specifically. I think it may have to do with the fact that processing is calling your void draw() method potentially 60+ times per second, but it seems that it never seemed to let go of the references.</p> <p>What I did to correct the issue was to load all the images / create the blits only once in the setup method() and only to append new items to the ArrayList when there was new data. </p> <p>Prior to this I would just recreate the entire ArrayList on the fly, because it seemed fast enough, but when running for a long time had this horrible memory leak issue. </p> <p>Now I was just assigned the blit to this reference, rather than creating a new object and ArrayList each time. It was much more efficient and didn't suffer from the same memory issue.</p> <p>For example something like this (run thousands of times in a loop):</p> <pre><code>tempImage = imageArrayList.get(i); // just assigns a reference, does not create a new object </code></pre> <p>instead of something like this:</p> <pre><code>tempImage = loadImage("image.jpg"); // this creates a new object every time it is called </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload