Skip to content

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

Closed
samaaron opened this Issue Feb 10, 2013 · 0 comments

1 participant

@samaaron
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]

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0:            Arrays.java:2882 java.util.Arrays.copyOf
  1: AbstractStringBuilder.java:100 java.lang.AbstractStringBuilder.expandCapacity
  2: AbstractStringBuilder.java:390 java.lang.AbstractStringBuilder.append
  3:       StringBuffer.java:224 java.lang.StringBuffer.append
  4:        StringWriter.java:84 java.io.StringWriter.write
  5:          core_print.clj:103 clojure.core/fn
  6:            MultiFn.java:167 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:            MultiFn.java:167 clojure.lang.MultiFn.invoke
 11:               core.clj:3266 clojure.core/pr-on
 12:                Var.java:419 clojure.lang.Var.invoke
 13:                RT.java:1717 clojure.lang.RT.print
 14:                RT.java:1696 clojure.lang.RT.printString
 15:   APersistentVector.java:25 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:             RestFn.java:460 clojure.lang.RestFn.invoke
 20:                comms.clj:44 overtone.sc.machinery.server.comms/server-snd
 21:             RestFn.java:139 clojure.lang.RestFn.applyTo
 22:                core.clj:603 clojure.core/apply
 23:               server.clj:81 overtone.sc.server/snd
 24:             RestFn.java:139 clojure.lang.RestFn.applyTo
 25:                core.clj:609 clojure.core/apply
 26:             RestFn.java:533 clojure.lang.RestFn.invoke
 27:              buffer.clj:252 overtone.sc.buffer/buffer-write!
 28:              buffer.clj:269 overtone.sc.buffer/buffer-write-relay!
 29:                Var.java:423 clojure.lang.Var.invoke
 30:            NO_SOURCE_FILE:1 user/eval16615
 31:          Compiler.java:6511 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…
…iciency.

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

Appears to fix #223.
5ebbc57
@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.