Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/vis15-bugs/heron-coll.diderot
ViewVC logotype

View of /tests/vis15-bugs/heron-coll.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4751 - (download) (annotate)
Sat Oct 15 13:08:12 2016 UTC (2 years, 9 months ago) by jhr
File size: 1625 byte(s)
adding heron-coll bug example
/*
Working on the examples at github, I got another memory problem related to shapshots. I think this is the first time snapshots led to a segfault, but it may be related to the memory errors I've noted previously.

Compiling the attached file with:

diderotc --snapshot --exec heron-coll.diderot

where diderotc is vis15    , then running just "./heron-coll" won't finish (because some strands never stabilize), but:

./heron-coll -l 20

will terminate, however (for my on my laptop) it stops with either a segfault, or a message like:

heron-coll(99598,0x7fff7607c000) malloc: *** error for object 0x7fde6a403a78: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

Valgrind also sees a problem, but for me gets stuck in an infinite look that I could stop only with "killall -9 valgrind" in a different shell.

I get the same memory problem if I actually run with snapshots (./heron-coll -s 1 -l 20).

Compiling without --snapshot, the program exits cleanly with "-l 20", with no valgrind problems.
*/

real minval = 1;
real maxval = 100;
int numval = 100;
real eps = 0.0000001;

strand sqroot (real val) {
   real root = val;
   int iter = 0;
   output vec4 vrie = [val,-1,-1,-1];

   update {
      if (val <= 0) {
         stabilize;
      }
      root = (root + val/root) / 2.0;
      iter += 1;
      if (|(root/val)*root - 1| < eps) {
         stabilize;
      }
   }
   stabilize {
      vrie = [val, root, iter, (root-sqrt(val))/sqrt(val)];
   }
}

initially { sqroot(lerp(minval, maxval, 1, ii, numval)) | ii in 1 .. numval };

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0