On Fri, Jan 14, 2005 at 03:37:30PM -0500, Dossy Shiobara wrote:
> I really need to figure out how to get Valgrind to do a leak check
> while the application is still running and has all the memory
> allocated, etc. That'd be really useful.
Naive question: What if you just purposely crash AOLserver? Will
Valgrind tell you what you want then?
There are probably known ways to make AOLserver crash just from Tcl,
but it's especially easy if you're willing to write a bit of C code.
E.g.:
static int
My_TclCmd(ClientData data, Tcl_Interp *interp, int argc, char **argv)
{
int rc;
const char *cmd;
if (argc < 2) {
Tcl_AppendResult(interp, argv[0], ": wrong # of args.", NULL);
return TCL_ERROR;
}
cmd = argv[1];
if (STREQ(cmd, "segfault")) {
int xx;
int * badPtr;
int debug_p = NS_FALSE;
if ( Ns_ConfigGetBool("ns/parameters", "debug", &debug_p) != NS_TRUE ) {
debug_p = NS_FALSE;
}
if (debug_p == NS_TRUE) {
Ns_Log(Error, "%s: %s: About to PURPOSELY segfault.", MODULE_NAME,
cmd);
badPtr = &my_constant;
while (1) {
xx = *badPtr;
badPtr = badPtr + 100000;
}
} else {
Ns_Log(Warning, "%s: %s: This command will run only when server is in
debug mode.",
MODULE_NAME, cmd);
}
}
return TCL_OK;
}
--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com/
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.