Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace upon assigning a long list of singleton lists to an R variable #1

Open
wouterbeek opened this issue May 3, 2017 · 1 comment

Comments

@wouterbeek
Copy link

wouterbeek commented May 3, 2017

Reproducible case:

?- [library(real)].
?- findall([N], between(1, 10000, N), L), x <- L.
[Thread 1]: failed to recover from trail-overflow
C-stack trace labeled "out-of-stack":
  [0] save_backtrace() at /home/wbeek/Git/swipl-devel/src/os/pl-cstack.c:322 [0x7f45b9c82cfa]
  [1] outOfStack() at /home/wbeek/Git/swipl-devel/src/pl-alloc.c:240 [0x7f45b9bbfdde]
  [2] unify_ptrs() at /home/wbeek/Git/swipl-devel/src/pl-prims.c:434 (discriminator 12) [0x7f45b9c08b55]
  [3] PL_skip_list() at /home/wbeek/Git/swipl-devel/src/pl-fli.c:1939 [0x7f45b9bc3c5d]
  [4] list_length() at real.c:? [0x7f45afbc35db]
  [5] term_length() at real.c:? [0x7f45afbc404b]
  [6] matrix_sexp() at real.c:? [0x7f45afbc47b9]
  [7] pl_sexp() at real.c:? [0x7f45afbc4f53]
  [8] set_r_variable() at real.c:? [0x7f45afbc65ad]
  [9] PL_next_solution() at /home/wbeek/Git/swipl-devel/src/pl-vmi.c:3680 [0x7f45b9bd3175]
  [10] query_loop() at /home/wbeek/Git/swipl-devel/src/pl-pro.c:135 [0x7f45b9c0d6db]
  [11] prologToplevel() at /home/wbeek/Git/swipl-devel/src/pl-pro.c:445 [0x7f45b9c0defb]
  [12] PL_toplevel() at /home/wbeek/Git/swipl-devel/src/pl-fli.c:4244 [0x7f45b9bc7b6d]
  [13] swipl(main+0x15) [0x5560c79c0825]
  [14] __libc_start_main() at /build/glibc-cxyGtm/glibc-2.24/csu/../csu/libc-start.c:325 [0x7f45b95d23f1]
  [15] swipl(_start+0x2a) [0x5560c79c086a]
C-stack trace labeled "crash":
  [0] save_backtrace() at /home/wbeek/Git/swipl-devel/src/os/pl-cstack.c:322 [0x7f45b9c82cfa]
  [1] outOfStack() at /home/wbeek/Git/swipl-devel/src/pl-alloc.c:232 [0x7f45b9bbffca]
  [2] unify_ptrs() at /home/wbeek/Git/swipl-devel/src/pl-prims.c:434 (discriminator 12) [0x7f45b9c08b55]
  [3] PL_skip_list() at /home/wbeek/Git/swipl-devel/src/pl-fli.c:1939 [0x7f45b9bc3c5d]
  [4] list_length() at real.c:? [0x7f45afbc35db]
  [5] term_length() at real.c:? [0x7f45afbc404b]
  [6] matrix_sexp() at real.c:? [0x7f45afbc47b9]
  [7] pl_sexp() at real.c:? [0x7f45afbc4f53]
  [8] set_r_variable() at real.c:? [0x7f45afbc65ad]
  [9] PL_next_solution() at /home/wbeek/Git/swipl-devel/src/pl-vmi.c:3680 [0x7f45b9bd3175]
  [10] query_loop() at /home/wbeek/Git/swipl-devel/src/pl-pro.c:135 [0x7f45b9c0d6db]
  [11] prologToplevel() at /home/wbeek/Git/swipl-devel/src/pl-pro.c:445 [0x7f45b9c0defb]
  [12] PL_toplevel() at /home/wbeek/Git/swipl-devel/src/pl-fli.c:4244 [0x7f45b9bc7b6d]
  [13] swipl(main+0x15) [0x5560c79c0825]
  [14] __libc_start_main() at /build/glibc-cxyGtm/glibc-2.24/csu/../csu/libc-start.c:325 [0x7f45b95d23f1]
  [15] swipl(_start+0x2a) [0x5560c79c086a]
[FATAL ERROR: at Wed May  3 23:14:23 2017
	Sorry, cannot continue]
@nicos-angelopoulos
Copy link
Owner

Dear Wouter,

many thanks for reporting. Will have a look the next few days.

In the meantime you can use terms instead of singletons:

?- findall( row(N), between(1, 10000, N), L), x <- L.
L = [row(1), row(2), row(3), row(4), row(5), row(6), row(7), row(8), row(...)|...].

?- <- x.
[,1]
[1,] 1
[2,] 2
[3,] 3

.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants