0

I am using Clojure with Lein repl. Using Frak tool (https://github.com/noprompt/frak) to create regex for very long strings.

However, as soon as string are fed with more than 205 character, it gives stackOverflow error:

frak=> (frak/pattern ["f" "quuxfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffssssssssssssssssssssrrrrrrrrrrrrrrrrrrrrrrrgtgggggg345g"])

StackOverflowError clojure.lang.AFn.applyToHelper (AFn.java:155)

This issue seems to be specific to my machine as it is passing in other machines.

I tried following outputs:

frak=> (defn stack-depth [n]
  #_=>   (try
  #_=>     (stack-depth (inc n))
  #_=>     (catch StackOverflowError _
  #_=>       (str "Max stack depth is " n))))
#'frak/stack-depth
frak=> (stack-depth 1)
"Max stack depth is 8439"
frak=> (stack-depth 1)
"Max stack depth is 8439"
frak=> (stack-depth 1)
"Max stack depth is 8439"

arpit@arpit-Lenovo-Z50-70:~tool_kit/frak$ ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 62265
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 62265
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Can anyone let me know how to resolve the stack overflow issue on Clojure?

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Arpit
  • 23
  • 3

0 Answers0