Re: [q-lang-users] Suggestions on how to debug?
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-12-18 20:04:24
|
Andrew Berg wrote: > ==> run fin.q > > ==> fetch_history "AA" > > C:\Documents and Settings\andrewb\Desktop\fin> > --------------------------------------------- > > Maybe this example does not make it so obvious, but it > appears to me that I am the victim of a silent > failure. Yes, I can confirm this, it also happens on Linux. It's a C stack overflow in the interpreter's internal eval routine. We've discussed this before, see: http://sourceforge.net/mailarchive/forum.php?thread_id=30658130&forum_id=36790 But there's not much I can do about it right now. It should be possible to handle these errors in a more friendly way (I still have this on the TODO list for the 7.x series), but that still won't make the real problem go away, which almost certainly is a space leak in your script (see below). (NB: John, I seem to recall that you asked a fellow chicken developer for the code they use to detect and handle C stack overflows. Did you ever get a reply?) Ok, to verify this stack overflow condition you can set Q's activation stack size to a small value, then the interpreter will give you a "soft" stack overflow error instead. E.g.: ==> stacksize 1024 ==> fetch_history "AA" ! Stack overflow >>> fetch_history "AA" ^ Now how to work around this? It looks like you have a space leak in your script, i.e., some huge unevaluated (special) arguments are getting passed around and then later evaluated. That could be the if-then in the definition of cache_get; try replacing that with a conditional equation. If that doesn't help, fire up Q's debugger to see exactly where those big expressions build up and try to rewrite this code. If you figure this out, please let me know. I might also take a closer look myself, when I have the time, because your program could be an interesting example for the "Gotchas" chapter of my Q book: space leaks in Q and how to avoid them. ;-) Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |