public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: "Sudarshan S Chawathe" <chaw@eip10.org>
To: Kawa mailing list <kawa@sourceware.org>
Subject: SRFI 41 "times3" example exhausts memory?
Date: Wed, 25 Apr 2018 21:13:00 -0000	[thread overview]
Message-ID: <15113.1524690829@vpaur.eip10.org> (raw)

I had occasion to revisit the SRFI 41 streams library in Kawa and
decided to try out a problematic "times3" example noted in the SRFI
document.  It ran successfully for small values of the argument but gave
a OutOfMemoryError when invoked as (times3 #e1e7). (Details below.)

I am not sure if this is a known limitation of the Kawa implementation
of SRFI 41 or if the problem is elsewhere, which is why I am not
reporting it as a bug/issue on Gitlab.

In any case, I thought I'd mention the issue here on the mailing list to
check if others have any thoughts on the matter.

Regards,

-chaw

** test.scm:
  
  (import (scheme base)
          (srfi 41))

  (define (times3 n)
    (stream-ref
      (stream-filter
        (lambda (x)
          (zero? (modulo x n)))
        (stream-from 0))
      3))

  (display (times3 #e1e7))
  (newline)

** trace:

  $ time kawa test.scm
  Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
  	at gnu.expr.CompiledProc.makeResultToObject(CompiledProc.java:41)
	  at gnu.kawa.slib.StreamsDerived$frame16.<init>(StreamsDerived.scm)
	  at gnu.kawa.slib.StreamsDerived$frame15.lambda35streamFrom(StreamsDerived.scm:169)
	  at gnu.kawa.slib.StreamsDerived$frame16.lambda38(StreamsDerived.scm:170)
	  at gnu.kawa.slib.StreamsDerived$frame16.lambda38$check(StreamsDerived.scm:170)
	  at java.lang.invoke.LambdaForm$DMH/702846463.invokeStatic_LL_L(LambdaForm$DMH)
	  at java.lang.invoke.LambdaForm$MH/1169794610.invokeExact_MT(LambdaForm$MH)
	  at gnu.mapping.CallContext.runUntilValue(CallContext.java:656)
	  at gnu.mapping.Procedure.apply0(Procedure.java:142)
	  at gnu.mapping.Promise.getValue(Promise.java:80)
	  at gnu.kawa.slib.StreamsPrimitive.isStreamNull(StreamsPrimitive.scm:52)
	  at gnu.kawa.slib.StreamsDerived$frame14.lambda31(StreamsDerived.scm:145)
	  at gnu.kawa.slib.StreamsDerived$frame14.lambda31$check(StreamsDerived.scm:144)
	  at java.lang.invoke.LambdaForm$DMH/1316557528.invokeStatic_LL_L(LambdaForm$DMH)
	  at java.lang.invoke.LambdaForm$MH/1169794610.invokeExact_MT(LambdaForm$MH)
	  at gnu.mapping.CallContext.runUntilValue(CallContext.java:656)
	  at gnu.mapping.Procedure.apply0(Procedure.java:142)
	  at gnu.mapping.Promise.getValue(Promise.java:80)
	  at gnu.kawa.slib.StreamsPrimitive.isStreamNull(StreamsPrimitive.scm:52)
	  at gnu.kawa.slib.StreamsDerived.streamRef(StreamsDerived.scm:275)
	  at test.times3(test.scm:10)
	  at test.times3$check(test.scm:4)
	  at java.lang.invoke.LambdaForm$DMH/284720968.invokeStaticInit_LL_L(LambdaForm$DMH)
	  at java.lang.invoke.LambdaForm$MH/1169794610.invokeExact_MT(LambdaForm$MH)
	  at gnu.mapping.CallContext.runUntilValue(CallContext.java:656)
	  at gnu.mapping.Procedure.apply1(Procedure.java:148)
	  at test.run(test.scm:12)
	  at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:289)
	  at gnu.expr.CompiledModule.evalModule(CompiledModule.java:42)
	  at gnu.expr.CompiledModule.evalModule(CompiledModule.java:60)
	  at kawa.Shell.runFile(Shell.java:565)
	  at kawa.Shell.runFileOrClass(Shell.java:468)

  real	6m12.696s
  user	17m16.376s
  sys	0m2.188s

** versions

  Kawa 3.0 (git describe: 3.0-87-g5fa934dad-dirty)
  Copyright (C) 2018 Per Bothner

  openjdk version "1.8.0_162"
  OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12)
  OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
   

                 reply	other threads:[~2018-04-25 21:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15113.1524690829@vpaur.eip10.org \
    --to=chaw@eip10.org \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).