<< Back to previous view

[ASYNC-32] onto-chan retains head of input sequence causing OutOfMemoryError Created: 06/Nov/13  Updated: 14/Feb/17  Resolved: 14/Feb/17

Status: Closed
Project: core.async
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Brian Lubeski Assignee: Unassigned
Resolution: Duplicate Votes: 3
Labels: memory


Attachments: File patch.clj    
Patch: Code
Approval: Triaged

(require '[clojure.core.async :as a])
(let [c (a/chan)]
  (a/onto-chan c (iterate inc 0))
  (while true
    (a/<!! c)))

onto-chan is holding on to the head of the input sequence as it is unfolded, resulting in an (eventual) OutOfMemoryError.

I've attached a diff showing changes I made to onto-chan that fixed the problem for me.

Comment by Colin Taylor [ 07/Oct/14 7:13 PM ]

Just to note, to-chan uses onto-chan so is similarly affected.
We ran into this, Brian's patch worked fine.

Comment by Alex Miller [ 10/Aug/15 3:22 PM ]

This seems like a viable change, but the patch needs a better test (even if not in the patch) and to be properly formatted for git apply (per http://dev.clojure.org/display/community/Developing+Patches).

Comment by Brian Lubeski [ 11/Aug/15 12:00 AM ]

This issue might be caused by ASYNC-138.

Comment by Nicola Mometto [ 15/Dec/15 6:12 PM ]

The fix for ASYNC-138 should fix this issue aswell and is more general

Comment by Alex Miller [ 14/Feb/17 10:35 AM ]

Duplicate of ASYNC-138

Generated at Thu Sep 21 02:05:20 CDT 2017 using JIRA 4.4#649-r158309.