I am having trouble with custom code that used to work but no longer does in the latest beta sources. The trouble seems to be related to symbol tables and/or reference counting etc. I managed to reduce the issues to a small piece of code which crashes under some circumstances but does not in the pre-805 J sources.

// in x.c
// Foreign 104 !: 1
...
case XC(104,1):  R CDERIV(CIBEAM, jttest, 0, RMAX, 0,   0  );
...

static F1(jttest){A z, n, loc=jt->local;
 RZ(w);
 RZ(jt->local=stcreate(2,1L,0L,0L));
 n=nfs(1,"A");
 IS(n,w);
 ex(box(cstr("A")));
 symfreeh(jt->local,0L);
 jt->local=loc;
 R w;
}

The code does the following:
1. Create a local symbol table
2. Assign the argument w to A in the local symbol table
3. Erase A in the local symbol table
4. Erase the local symbol table
5. Return the argument

Doing the following in the J session causes a crash in symfreeh due to accessing invalid memory in jt->sympv

   104!:1 ] 1 2 3
1 2 3
   B=. 1 2 3
   104!:1 B
1 2 3
   104!:1 B
1 2 3
   104!:1 B
1 2 3
   104!:1 B
1 2 3
   104!:1 B
BOOM!

Is this a bug or is there a new way to deal with local symbol tables?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to