Folks, with AOLserver 3.3+ad13 on Solaris (SunOS 5.*), in my own
loadable module, I have a Tcl command implemented in C that creates a
new ns_set and then does stuff with it, pretty much like this:

  setPtr = Ns_SetCreate("TclReceiveDataCmd");

  /* Do more C stuff - stick data into the set, etc. */

  /*
   * We are using NS_TCL_SET_DYNAMIC, so presumably, we never need to
   * call Ns_SetFree.
   */

  Ns_TclEnterSet(interp, setPtr, NS_TCL_SET_DYNAMIC);
  return TCL_OK;

(Oh yeah, and I'm using '#define NS_TCL_SET_DYNAMIC 1' like in the
AOLserver 4.x codebase, because it's more understandable than the old
3.x terms for the same thing.)

Problem is, I'm sometimes getting a segfault during the malloc in the
Ns_SetCreate (see below), and I don't understand why.  Could someone
give me advice on this, please?  Thanks!

  Program received signal SIGSEGV, Segmentation fault.
  [Switching to LWP 7]
  0xff14140c in _malloc_unlocked () from /lib/libc.so.1
  (gdb) bt
  #0  0xff14140c in _malloc_unlocked () from /lib/libc.so.1
  #1  0xff141294 in malloc () from /lib/libc.so.1
  #2  0x1414b4 in ns_malloc (size=80) at memory.c:126
  #3  0x5a1bc in Ns_SetCreate (name=0xfe6a94e8 "BB_TclReceiveDataCmd")
      at set.c:91
  #4  0xfe6a7e7c in BB_TclCmd (data=0x0, interp=0x189120, argc=3,
      argv=0xfddfd1e0) at nsbbapi.c:2251

--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com

Reply via email to