I've been a bit puzzled the last few days about a memory fault I've been getting. It turns out to be the control stack getting exhausted, but the error I have been getting is simply a "memory fault". I thought I should share this, in case it's possible to print that the error is a control stack problem, rather than the more vague "memory fault" error.
It took me a while of adding numerous print-outs to my code to find the error, but it turned out to be coming from this form, which appends a list of lists:
(apply 'append list-of-lists)
Before I discovered that it was a control stack size issue (which SBCL on my Mac is now showing), I tried this instead, which doesn't cause the error:
(apply 'concatenate 'list list-of-lists)
The list of lists is length 100,000. So, it's easy to reproduce this with (or increase the 100,000 to be big enough to fill the control stack):
(apply 'append (make-list 100000 :initial-element '()))
It makes sense that this would exhaust the stack. (I am aware of how to increase the stack size with --control-stack-size).
On Linux (and sometimes on Mac), I get the error:
CORRUPTION WARNING in SBCL pid 16130(tid 140737353885424):
Memory fault at f293d040 (pc=0x100050d041, sp=0x7ffff293d040)
The integrity of this image is possibly compromised.
Exiting.
Previously, I was getting the same error on Mac, but now I'm getting a control stack exhausted error:
fatal error encountered in SBCL pid 91825:
Control stack exhausted
This is SBCL 1.0.55 on Mac, and 1.1.0 on Linux (x86-64).
So, I suppose my questions are:
1) Does it make sense that APPEND exhausts the stack, but CONCATENATE doesn't?
2) Is it possible to catch the error and report it as "control stack exhausted" rather than simply as a "memory fault"?
Thanks,
Ben
Benjamin Lambert
Ph.D. Student of Computer Science
Carnegie Mellon University
www.cs.cmu.edu/~belamber
--------------------------------------------------------------------------- ---
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________
Sbcl-help mailing list
Sbcl-h...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
Benjamin Lambert <benlamb...@cmu.edu> writes:
> Hi there,
> I've been a bit puzzled the last few days about a memory fault I've
> been getting. It turns out to be the control stack getting exhausted,
> but the error I have been getting is simply a "memory fault". I
> thought I should share this, in case it's possible to print that the
> error is a control stack problem, rather than the more vague "memory
> fault" error.
> It took me a while of adding numerous print-outs to my code to find the error, but it turned out to be coming from this form, which appends a list of lists:
> (apply 'append list-of-lists)
> Before I discovered that it was a control stack size issue (which SBCL on my Mac is now showing), I tried this instead, which doesn't cause the error:
> (apply 'concatenate 'list list-of-lists)
> The list of lists is length 100,000. So, it's easy to reproduce this with (or increase the 100,000 to be big enough to fill the control stack):
> (apply 'append (make-list 100000 :initial-element '()))
> It makes sense that this would exhaust the stack. (I am aware of how to increase the stack size with --control-stack-size).
> On Linux (and sometimes on Mac), I get the error:
> CORRUPTION WARNING in SBCL pid 16130(tid 140737353885424):
> Memory fault at f293d040 (pc=0x100050d041, sp=0x7ffff293d040)
> The integrity of this image is possibly compromised.
> Exiting.
> Previously, I was getting the same error on Mac, but now I'm getting a control stack exhausted error:
> fatal error encountered in SBCL pid 91825:
> Control stack exhausted
> This is SBCL 1.0.55 on Mac, and 1.1.0 on Linux (x86-64).
> So, I suppose my questions are:
> 1) Does it make sense that APPEND exhausts the stack, but CONCATENATE doesn't?
> 2) Is it possible to catch the error and report it as "control stack exhausted" rather than simply as a "memory fault"?
> Thanks,
> Ben
You shouldn't ever use APPLY on an arbitrary number of arguments. Use
reduce instead:
(reduce #'append list-of-lists :from-end t)
(from-end helps minimize consing, because append always has to copy the
first list, that way the first list doesn't become larger with each
iteration)
-- With best regards, Stas.
--------------------------------------------------------------------------- ---
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________
Sbcl-help mailing list
Sbcl-h...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
Benjamin Lambert <benlamb...@cmu.edu> writes:
> Hi there,
> I've been a bit puzzled the last few days about a memory fault I've
> been getting. It turns out to be the control stack getting exhausted,
> but the error I have been getting is simply a "memory fault". I
> thought I should share this, in case it's possible to print that the
> error is a control stack problem, rather than the more vague "memory
> fault" error.
> It took me a while of adding numerous print-outs to my code to find the error, but it turned out to be coming from this form, which appends a list of lists:
> (apply 'append list-of-lists)
> Before I discovered that it was a control stack size issue (which SBCL on my Mac is now showing), I tried this instead, which doesn't cause the error:
> (apply 'concatenate 'list list-of-lists)
> The list of lists is length 100,000. So, it's easy to reproduce this with (or increase the 100,000 to be big enough to fill the control stack):
> (apply 'append (make-list 100000 :initial-element '()))
> It makes sense that this would exhaust the stack. (I am aware of how to increase the stack size with --control-stack-size).
> On Linux (and sometimes on Mac), I get the error:
> CORRUPTION WARNING in SBCL pid 16130(tid 140737353885424):
> Memory fault at f293d040 (pc=0x100050d041, sp=0x7ffff293d040)
> The integrity of this image is possibly compromised.
> Exiting.
> Previously, I was getting the same error on Mac, but now I'm getting a control stack exhausted error:
> fatal error encountered in SBCL pid 91825:
> Control stack exhausted
> This is SBCL 1.0.55 on Mac, and 1.1.0 on Linux (x86-64).
> So, I suppose my questions are:
> 1) Does it make sense that APPEND exhausts the stack, but CONCATENATE doesn't?
> 2) Is it possible to catch the error and report it as "control stack exhausted" rather than simply as a "memory fault"?
--------------------------------------------------------------------------- ---
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________
Sbcl-help mailing list
Sbcl-h...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
>> 2) Is it possible to catch the error and report it as "control stack exhausted" rather than simply as a "memory fault"?
> And as to the error you're seeing, there's a bug ticket:
> https://bugs.launchpad.net/sbcl/+bug/484143
Ahh, I see. Thanks Stas. And thanks especially about the tip to use REDUCE rather than APPLY! Now why didn't I think of that... duh.
Best,
Ben
> -- > With best regards, Stas.
--------------------------------------------------------------------------- ---
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________
Sbcl-help mailing list
Sbcl-h...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
On Sat, Oct 20, 2012 at 12:31 AM, Benjamin Lambert <benlamb...@cmu.edu> wrote: >>> 2) Is it possible to catch the error and report it as "control stack exhausted" rather than simply as a "memory fault"? >> And as to the error you're seeing, there's a bug ticket: >> https://bugs.launchpad.net/sbcl/+bug/484143
> Ahh, I see. Thanks Stas. And thanks especially about the tip to use REDUCE rather than APPLY! Now why didn't I think of that... duh.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org The penalty for laughing in a courtroom is six months in jail; if it were not for this penalty, the jury would never hear the evidence. — H. L. Mencken
--------------------------------------------------------------------------- --- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Sbcl-help mailing list Sbcl-h...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sbcl-help