chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] heap size or macro problem


From: Rick Taube
Subject: [Chicken-users] heap size or macro problem
Date: Sun, 4 Nov 2007 10:59:53 -0600

hi ive got a weird bug that i cant figure out. when i boot chicken i trigger a crash depending on whether or not i eval any sexpr before i eval the sexpr i want. my sexpr involves a macro definition called 'go' whose source code is csc'ed and linked into the host C app. when we start chicken imder the app we load chicken-more-macros so the 'go' expansion is available as a runtime statement for the user's session in the repl. for example this user session will work: if i eval (print 1) before I (define aaa ...) then I can repeatedly call (aaa) without my app crashing:

(print 1)

(define aaa
  (go ((i 0 (+ i 1))
       (e 200))
      ((= i e) #f)
    0))

(aaa 0)

-----------------------------------------

but if i restart and simply do

(define aaa
  (go ((i 0 (+ i 1))
       (e 200))
      ((= i e) #f)
    0))

(aaa 0)

-----------------------------------------
then after 3 or 4 eval of (aaa 0) it triggers the error:

out of memory - heap full while resizing - execution terminated

...more...
<eval>
<eval>
<eval>
<eval>
<eval>
<syntax>
<eval>
<eval>  <--

------------------------------------------------------------------

i dont understand why it works if i "exercise" chicken first by evalling something before I call my program but if i start by calling my program it dies. one more thing: my macro does involves wrapping code inside a with-exception handler:

 `(call-with-current-continuation
    (lambda (k)
      (with-exception-handler
        (lambda (,errorvar)
          (printf ">>> Aborting process at time ~S:~%    Error: ~S"
                  ,paramvar
                  ((condition-property-accessor 'exn 'message)
                  ,errorvar))
          (k -1))
        (lambda () ,procbody))))


it seems that if i leave out the error protection then I can run my program first thing, ie without evalling a useless sexor fist. but maybe this is just because ive got a smaller code size. if i initialzie chicken DEFAULT_HEAP_SIZE*6 then when i start chicken then i can run my program. So i realize that one answer might be "well...then increase your heap 6x before you run your progam!" but I dont know if this is treating the cause or the symptom of my problem and dont understand why it works if i start the default heap size and then first eval something other than the program i want .

sorry but im a chicken newbie and cant begin to figure out how to fix this problem. it seems that to have the user guess an initial heap size is one way, but crashing the whole C environment (we have chicken running inside a JUCE-based GUI) is a steep price to pay to find out

--rick










reply via email to

[Prev in Thread] Current Thread [Next in Thread]