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

Duplicates in constructor result in an infinite loop #27

Open
stewSquared opened this issue May 19, 2019 · 0 comments
Open

Duplicates in constructor result in an infinite loop #27

stewSquared opened this issue May 19, 2019 · 0 comments

Comments

@stewSquared
Copy link

stewSquared commented May 19, 2019

Perm(3,4,5,3)

result in an infinite loop that eventually consumes all memory.

We should probably filter duplicates or throw an IllegalArgumentException.

Stack trace for the above:

java.lang.OutOfMemoryError: GC overhead limit exceeded
  at scala.collection.immutable.List.$colon$colon(List.scala:112)
  at net.alasc.perms.Cycle$.rec$1(Cycle.scala:96)
  at net.alasc.perms.Cycle$.orbit(Cycle.scala:98)
  at net.alasc.perms.Cycles$.rec$1(Cycles.scala:103)
  at net.alasc.perms.Cycles$.fromSupportAndImageFun(Cycles.scala:108)
  at net.alasc.perms.internal.GenPrmOps$.toCycles$extension(GenPrmOps.scala:52)
  at net.alasc.perms.Perm.toString(Perm.scala:17)
  at scala.runtime.ScalaRunTime$.inner$1(ScalaRunTime.scala:250)
  at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:255)
  at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:263)
  at .$print$lzycompute(<console>:10)
  at .$print(<console>:6)
  at $print(<console>)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:735)
  at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:999)
  at scala.tools.nsc.interpreter.IMain.$anonfun$interpret$1(IMain.scala:567)
  at scala.tools.nsc.interpreter.IMain$$Lambda$4658/2087216452.apply(Unknown Source)
  at scala.reflect.internal.util.ScalaClassLoader.asContext(ScalaClassLoader.scala:34)
  at scala.reflect.internal.util.ScalaClassLoader.asContext$(ScalaClassLoader.scala:30)
  at scala.reflect.internal.util.AbstractFileClassLoader.asContext(AbstractFileClassLoader.scala:33)
  at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:566)
  at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:593)
  at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:563)
  at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:886)
  at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:754)
  at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:456)
  at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:477)
  at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1069)

@stewSquared stewSquared changed the title Cycle in constructor results in an infinite loop Duplicates in constructor result in an infinite loop May 19, 2019
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

1 participant