From: Ken A. <kan...@bb...> - 2003-10-24 15:49:12
|
I'm sending this again. I think BBN had mailer trouble for a while. At 11:16 AM 10/22/2003 -0400, Matthew W. Bilotti wrote: >Dear JScheme developers, > >We were wondering what this error means. It seems to come up after our >program has been doing what it is supposed to for awhile, and it is >accompanied by no other error message or Java exception. We were hoping >you could shed some light on this: > >Fatal error allocating 12 bytesAborted I have not seen this error before. It may be related to your stack overflow. >Also, in a slightly related question, we were wondering if there is any >way to tell how deep we are recursing or what the limit is. It seems as >if we blow the stack a lot like this: > >> java.lang.StackOverflowError >> at jsint.DynamicEnvironment.getValue(DynamicEnvironment.java:95) >> at >jsint.DynamicVariable.getDynamicValue(DynamicVariable.java:13) >> at jsint.Scheme.execute(Scheme.java:484) >> at jsint.Scheme.execute(Scheme.java:514) >> at jsint.Procedure.makeArgArray(Procedure.java:142) >> at jsint.Scheme.execute(Scheme.java:521) >> at jsint.Scheme.execute(Scheme.java:497) >> * at jsint.Procedure.makeArgArray(Procedure.java:142) >> * at jsint.Scheme.execute(Scheme.java:521) > >Where the two starred lines repeat over and over again a great many times. >Rewriting our procedure iteratively had no effect. I only got it to work >by rewriting it in Java. I am sure there is no hidden infinite recursion >somewhere in our code because it works for a short input. The code also You can run this program to see how deep your stack is: (define (grow n) (set! *n* n) (cons 1 (grow (+ n 1)))) (grow 1) I get *n* to have values between 1050 and 1100. If you write the same program in Java: package using; import jsint.Pair; public class Stack { public static Object grow(int n) { System.out.println(n); return new Pair("1", grow(n+1)); } public static void main(String[] args) { grow(1); } } You get 5600. So your Java version may be working because it makes better use of the stack, or you write it some other way that avoids recursion. While on windows at least, there is a -Xssn command line argument to java that sets the thread stack size, i've not been able to effect the stack size with it. My guess is you're doing something that's recursive, try rewriting it to use tail calls. Send me some code if you need more help. >allocates a lot of data on the heap. Is JScheme efficient with its memory JScheme is as efficient with memory and GC as Java is. >and garbage collection? Do the heap and the stack share memory? Could >this be the problem? We are running with -Xmx1024m. The -Xmx only effects the heap size, not the stack size. >Any insight you have would be greatly appreciated. > >Regards, > >Matthew Bilotti > >-- >matthew w. bilotti >artificial intelligence laboratory >massachusetts institute of technology > > > > >------------------------------------------------------- >This SF.net email is sponsored by OSDN developer relations >Here's your chance to show off your extensive product knowledge >We want to know what you know. Tell us and you have a chance to win $100 >http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 >_______________________________________________ >Jscheme-devel mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-devel |