[Bug-openmcl] Help with Problem/Bug?
Gary Byers
gb at clozure.com
Wed Dec 17 12:29:45 MST 2003
On Wed, 17 Dec 2003, Warren A. Hunt Jr. wrote:
> Hi,
>
> I have enjoyed using openmcl. I first want to thank everyone that
> helps make this software available.
>
But ...
> Is there a way to extend the "control stack"? My program failed when
> I attempted to take the length of a medium-sized list (around 65,000)
> elements because it exhausted the control stack.
There used to be (up until about 1-1/2 years ago) support for
"segmented" stacks that were dynamically extensible. That wasn't 100%
reliable, could add substantial overhead in some cases, and didn't
work well with native threading models or with some foreign code that
assumed that stacks were linear (and that largish data structures
could be safely stack-allocated.) The "dynamically extensible" part
was nice; everything else wasn't; gaining some improved reliability
and interoperablity cost ... flexibility.
>
> > Error: Stack overflow on control stack.
> > While executing: LEN
> > Type :POP to abort.
> Type :? for other options.
> 1 > ?
>
You can control the size of the initial thread's stack with a command-line
argument, and control the sizes of other thread's stacks through appropriate
arguments to MAKE-PROCESS and PROCESS-RUN-FUNCTION, which are described in
<http://openmcl.clozure.com/Doc/threads.html>.
It's a little trickier to affect the size of the initial listener's stacks;
if you really, really want to do this I'll try to explain how.
> The definition of LEN is:
>
> (defun len (x)
> (if (atom x)
> 0
> (1+ (len (cdr x)))))
>
Note that the recursive call to LEN isn't tail-recursive. One way to
define LEN recursively in a manner that'll use constant stack space is:
(defun len (x)
(labels ((len-n (x n)
(if (atom x)
n
(len-n (cdr x) (1+ n)))))
(len-n x 0)))
> Is there a manual of any kind manual for "openmcl"?
>
The online documentation (on the website or in "ccl:doc;HTML;*.html")
is about it, I'm afraid.
More information about the Bug-openmcl
mailing list