On Mon, Mar 16, 2009 at 09:09:41PM +0100, felix winkelmann wrote:
> Well done, Taylor. Chicken coalesces all allocations inside a single
> generated C procedure and allocates it as one chunk. It seems here
> that the stack is already too small to hold the data, even after a minor
> GC was invoked. Can you reproduce the hang with larger settings for
> "-:s..."? If you add "-:d", you should see messages like
> 
> [debug] stack resized to XXXX bytes
> 
> If you can't reproduce the hang with higher settings, change the makefile
> (defaults.make or rules.make and pass "-:s<goodvalue>" to the "chicken-boot"
> invocations and look how far it gets (BTW, what does "./chicken-boot -:d" 
> show?)
> Then we probably have a precompiled bootstrapping compiler with a too
> low nursery setting, even though this used to work. It also may be something
> completely different.

Yes, now that I've tried these things I think that what I've run into
during the build process initially is different from the small stack
size that I've been using for this.  Or in other words I think there
may be two separate problems here, or at least I've figured out how to
get the program to hang in two different conditions.

First, here is the output with -:d for what proceeds normally.  Note
that with this build (done with "make PLATFORM=linux DEBUG_BUILD=yes
bootstrap") the original scenario works.

[debug] application startup...
[debug] heap resized to 500000 bytes
[debug] stack bottom is 0x7fffce663a60.
[debug] entering toplevel toplevel...
[debug] stack resized to 262144 bytes
[debug] entering toplevel library_toplevel...
[debug] entering toplevel eval_toplevel...
[debug] entering toplevel data_structures_toplevel...
[debug] entering toplevel ports_toplevel...
[debug] entering toplevel extras_toplevel...
[debug] entering toplevel srfi_69_toplevel...
[debug] entering toplevel srfi_1_toplevel...
[debug] entering toplevel match_toplevel...
[debug] entering toplevel srfi_4_toplevel...
[debug] entering toplevel utils_toplevel...
[debug] entering toplevel regex_toplevel...
[debug] entering toplevel files_toplevel...
[debug] entering toplevel support_toplevel...
[debug] resizing heap dynamically from 500k to 1040k ...
[debug] entering toplevel compiler_toplevel...
[debug] entering toplevel optimizer_toplevel...
[debug] entering toplevel driver_toplevel...
[debug] entering toplevel platform_toplevel...
[debug] entering toplevel backend_toplevel...
[debug] resizing heap dynamically from 1040k to 2081k ...
[debug] resizing heap dynamically from 2081k to 4163k ...
[debug] forcing finalizers...
[debug] resizing heap dynamically from 4163k to 2081k ...

Now, here's the output when I add -:s10k to that:

[debug] application startup...
[debug] heap resized to 500000 bytes
[debug] stack bottom is 0x7fff275a99d0.
[debug] entering toplevel toplevel...
[debug] entering toplevel library_toplevel...

The last line repeats forever until I kill it.  There is no marked
increase in memory consumption.

HOWEVER I did figure out how to reproduce it for higher values of -:s
using a script that just stepped through trying increasing values
until it hung.  There are several that I found; both -:s74k and
-:s262k trigger it.  The GDB output from the latter case is attached.
Note that the backtrace gets larger and larger the longer you let it
run, and it repeats (starting at frame #57 <-> #16).

The behaviour in this last case seems different than that of the
-:s10k case.  The former never grew the heap, but continually called
the GC process.  But the latter is constantly growing the heap and as
a result the memory usage balloons.  I couldn't say if they're both
reflections of the same problem or if they're different.

Since regex.c seems heavily involved in this last case, I've also put
it on my website at: http://real.metasyntax.net:2357/tmp/regex.c.gz

-- 
Taylor Christopher Venable
http://real.metasyntax.net:2357/
Starting program: /home/taylor/Desktop/chicken-3.4.7-DEBUG/chicken-boot 
utils.scm -quiet -no-trace -optimize-level 2 -include-path . -include-path ./ 
-explicit-use -output-file utils.c -:d -:s262k
[debug] application startup...
[debug] heap resized to 500000 bytes
[debug] stack bottom is 0x7fff4561ba10.
[debug] entering toplevel toplevel...
[debug] entering toplevel library_toplevel...
[debug] entering toplevel eval_toplevel...
[debug] entering toplevel data_structures_toplevel...
[debug] entering toplevel ports_toplevel...
[debug] entering toplevel extras_toplevel...
[debug] entering toplevel srfi_69_toplevel...
[debug] entering toplevel srfi_1_toplevel...
[debug] entering toplevel match_toplevel...
[debug] entering toplevel srfi_4_toplevel...
[debug] entering toplevel utils_toplevel...
[debug] entering toplevel regex_toplevel...
[debug] entering toplevel files_toplevel...
[debug] resizing heap dynamically from 500k to 1000k ...
[debug] resizing heap dynamically from 1000k to 2000k ...
[debug] resizing heap dynamically from 2000k to 4000k ...
[debug] resizing heap dynamically from 4000k to 8000k ...
[debug] resizing heap dynamically from 8000k to 16000k ...
[debug] resizing heap dynamically from 16000k to 32000k ...
[debug] resizing heap dynamically from 32000k to 64000k ...
[debug] resizing heap dynamically from 64000k to 128000k ...
[debug] resizing heap dynamically from 128000k to 256000k ...
[debug] resizing heap dynamically from 256000k to 512000k ...
[debug] resizing heap dynamically from 512000k to 1024000k ...
[debug] resizing heap dynamically from 1024000k to 2048000k ...
^C
Program received signal SIGINT, Interrupt.
0x00007fc03cc87157 in memcpy () from /lib/libc.so.6
#0  0x00007fc03cc87157 in memcpy () from /lib/libc.so.6
#1  0x00000000008420a5 in remark (x=0x7fbfccfddf58) at runtime.c:3436
#2  0x0000000000841bbf in C_rereclaim2 (size=1024000000, double_plus=0) at 
runtime.c:3302
#3  0x00000000008402e2 in C_reclaim (trampoline=0x781fce, proc=0x79ddb8) at 
runtime.c:2756
#4  0x00000000008400e5 in C_save_and_reclaim (trampoline=0x781fce, 
proc=0x79ddb8, n=-1) at runtime.c:2700
#5  0x000000000079de08 in f_12298 (c=2, t0=140734357152424, t1=10) at 
regex.c:9759
#6  0x00000000006484d4 in f_3890 (c=3, t0=140462604734272, t1=140734357152424, 
t2=140734357152688) at library.c:34178
#7  0x000000000079ddb8 in f_12097 (t1=140734357152800, t2=140462604820624, 
t3=140734357152688) at regex.c:9750
#8  0x00000000007a196d in f_12100 (t1=140734357152800, t2=140462604820624, 
t3=140734357155376, t4=29) at regex.c:10452
#9  0x000000000079fdd2 in f_12413 (t0=140734357152928, t1=140462604820624) at 
regex.c:10091
#10 0x000000000079fcc1 in f_12410 (t0=140734357153136, t1=140462604820624) at 
regex.c:10077
#11 0x000000000079facb in f_12450 (c=2, t0=140734357153664, t1=140462604846200) 
at regex.c:10059
#12 0x000000000079c4ec in f_12842 (t1=140734357153664, t2=29, 
t3=140462604846200) at regex.c:9384
#13 0x000000000079f870 in f_12401 (c=2, t0=140734357154016, t1=140462604846200) 
at regex.c:10039
#14 0x0000000000648426 in f_3900 (c=3, t0=140462604734240, t1=140734357154016, 
t2=140462604820624) at library.c:34165
#15 0x000000000079f671 in f_12397 (c=7, t0=140734357155872, t1=140734357159056, 
t2=140734357155376,
    t3=140734357155192, t4=140734357154880, t5=6, t6=6) at regex.c:10019
#16 0x0000000000890e6c in l3 ()
#17 0x0000000000000006 in ?? ()
#18 0x0000000000000006 in ?? ()
#19 0x00000000008e1f15 in ?? ()
#20 0x00007fff455db020 in ?? ()
#21 0x00007fff455daa60 in ?? ()
#22 0x000000000079f870 in f_12401 (c=140734357154792, t0=-5608648, 
t1=-8941369294555703808) at regex.c:10039
#23 0x000000000079f456 in f_12462 (c=2, t0=140734357155928, t1=140734357154672) 
at regex.c:10005
#24 0x000000000079d5ed in f_12690 (t0=140734357154904, t1=6) at regex.c:9639
#25 0x000000000079d50a in f_12682 (t0=140734357155136, t1=140734357155192) at 
regex.c:9629
#26 0x000000000079d283 in f_12678 (t0=140734357155328, t1=140734357155376) at 
regex.c:9597
#27 0x000000000079d0a4 in f_12645 (t1=140734357155928, t2=140734357161632, 
t3=140734357161136) at regex.c:9574
#28 0x000000000079f411 in f_12470 (c=2, t0=140734357155960, t1=140734357161136) 
at regex.c:9998
#29 0x00000000006484d4 in f_3890 (c=3, t0=140462604734272, t1=140734357155960, 
t2=140462604820624) at library.c:34178
#30 0x000000000079f329 in f_12392 (t0=140734357157184, t1=22) at regex.c:9983
#31 0x000000000079f0f2 in f_12507 (c=2, t0=140734357156352, 
t1=-9223231573959114998) at regex.c:9960
#32 0x00000000006480b8 in f_3947 (c=3, t0=140462604735312, t1=140734357156352, 
t2=140462604820624) at library.c:34100
#33 0x000000000079f082 in f_12511 (c=2, t0=140734357156560, t1=14680074) at 
regex.c:9949
#34 0x00000000006482ca in f_3920 (c=3, t0=140462604735344, t1=140734357156560, 
t2=140462604820624) at library.c:34139
#35 0x000000000079ef74 in f_12491 (t0=140734357156912, t1=6) at regex.c:9935
#36 0x000000000079eddd in f_12525 (c=2, t0=140734357156960, t1=14680074) at 
regex.c:9910
#37 0x00000000006482ca in f_3920 (c=3, t0=140462604735344, t1=140734357156960, 
t2=140462604820624) at library.c:34139
#38 0x000000000079ec92 in f_12529 (c=2, t0=140734357157256, t1=140734357161136) 
at regex.c:9890
#39 0x00000000006484d4 in f_3890 (c=3, t0=140462604734272, t1=140734357157256, 
t2=140462604820624) at library.c:34178
#40 0x000000000079ea9c in f_12334 (t0=140734357157792, t1=6) at regex.c:9874
#41 0x000000000079e521 in f_12553 (c=2, t0=140734357157880, t1=140734357161136) 
at regex.c:9821
#42 0x00000000006484d4 in f_3890 (c=3, t0=140462604734272, t1=140734357157880, 
t2=140462604820624) at library.c:34178
#43 0x000000000079e3ce in f_12306 (t0=140734357158144, t1=140734357159056, 
t2=140462604820624, t3=14) at regex.c:9804
#44 0x000000000079e0a6 in f_12301 (c=2, t0=140734357158416, t1=14679818) at 
regex.c:9779
#45 0x0000000000648426 in f_3900 (c=3, t0=140462604734240, t1=140734357158416, 
t2=140734357158944) at library.c:34165
#46 0x000000000079deec in f_12298 (c=2, t0=140734357158680, t1=10) at 
regex.c:9763
#47 0x00000000006484d4 in f_3890 (c=3, t0=140462604734272, t1=140734357158680, 
t2=140734357158944) at library.c:34178
#48 0x000000000079ddb8 in f_12097 (t1=140734357159056, t2=140462604820624, 
t3=140734357158944) at regex.c:9750
#49 0x00000000007a196d in f_12100 (t1=140734357159056, t2=140462604820624, 
t3=140734357161632, t4=29) at regex.c:10452
#50 0x000000000079fdd2 in f_12413 (t0=140734357159184, t1=140462604820624) at 
regex.c:10091
#51 0x000000000079fcc1 in f_12410 (t0=140734357159392, t1=140462604820624) at 
regex.c:10077
#52 0x000000000079facb in f_12450 (c=2, t0=140734357159920, t1=140462604846200) 
at regex.c:10059
#53 0x000000000079c4ec in f_12842 (t1=140734357159920, t2=29, 
t3=140462604846200) at regex.c:9384
#54 0x000000000079f870 in f_12401 (c=2, t0=140734357160272, t1=140462604846200) 
at regex.c:10039
#55 0x0000000000648426 in f_3900 (c=3, t0=140462604734240, t1=140734357160272, 
t2=140462604820624) at library.c:34165
#56 0x000000000079f671 in f_12397 (c=7, t0=140734357162128, t1=140734357165312, 
t2=140734357161632,
    t3=140734357161448, t4=140734357161136, t5=6, t6=6) at regex.c:10019
#57 0x0000000000890e6c in l3 ()         ;; NOTE - SAME AS FRAME #16 FROM HERE 
ON DOWN...
#58 0x0000000000000006 in ?? ()         ;; 
=============================================
#59 0x0000000000000006 in ?? ()
#60 0x00000000008e1f15 in ?? ()
#61 0x00007fff455dc890 in ?? ()
#62 0x00007fff455dc2d0 in ?? ()
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to