Skip to content

Using buffer-write-relay! with large amounts of data causes the JVM to run out of heap space #223

samaaron opened this Issue Feb 10, 2013 · 0 comments

1 participant

Overtone member

This issue started in the comments of #222

Minimal code to produce error:

(def buf1 (sample (freesound-path 164123)))
(def buf1-data (buffer-data buf1))
(def buf1-data1 (take 1000000 buf1-data)) 
(buffer-write-relay! buf1 0 buf1-data1)

Stack trace produced:

Java heap space
  [Thrown class java.lang.OutOfMemoryError]

 0: [QUIT] Quit to the SLIME top level

  0:   java.util.Arrays.copyOf
  1: java.lang.AbstractStringBuilder.expandCapacity
  2: java.lang.AbstractStringBuilder.append
  3: java.lang.StringBuffer.append
  5:          core_print.clj:103 clojure.core/fn
  6:   clojure.lang.MultiFn.invoke
  7:               core.clj:3266 clojure.core/pr-on
  8:           core_print.clj:58 clojure.core/print-sequential
  9:          core_print.clj:191 clojure.core/fn
 10:   clojure.lang.MultiFn.invoke
 11:               core.clj:3266 clojure.core/pr-on
 12:       clojure.lang.Var.invoke
 13:       clojure.lang.RT.print
 14:       clojure.lang.RT.printString
 15: clojure.lang.APersistentVector.toString
 16:                core.clj:497 clojure.core/str
 17:                core.clj:501 clojure.core/str[fn]
 18:                core.clj:503 clojure.core/str
 19:    clojure.lang.RestFn.invoke
 20:                comms.clj:44
 21:    clojure.lang.RestFn.applyTo
 22:                core.clj:603 clojure.core/apply
 23:               server.clj:81
 24:    clojure.lang.RestFn.applyTo
 25:                core.clj:609 clojure.core/apply
 26:    clojure.lang.RestFn.invoke
 27:              buffer.clj:252!
 28:              buffer.clj:269!
 29:       clojure.lang.Var.invoke
 30:            NO_SOURCE_FILE:1 user/eval16615
 31: clojure.lang.Compiler.eval
@samaaron samaaron added a commit that closed this issue Nov 21, 2013
@samaaron samaaron Move to using vecs and subvecs for buffer-write-relay! to improve eff…

Also reduce MAX-OSC-SAMPLES to a value that works on my machine with an external server. 

Appears to fix #223.
@samaaron samaaron closed this in 5ebbc57 Nov 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.