Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-13 Thread Simon Marlow
On 12/05/2014 21:28, Brandon Simmons wrote: The idea is I'm using two atomic counters to coordinate concurrent readers and writers along an infinite array (a linked list of array segments that get allocated as needed and garbage collected as we go). So currently each cell in each array is

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-12 Thread Simon Marlow
On 10/05/2014 21:57, Brandon Simmons wrote: Another silly question: when card-marking happens after a write or CAS, does that indicate this segment maybe contains old-to-new generation references, so be sure to preserve (scavenge?) them from collection ? Yes, that's exactly right. Cheers,

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-12 Thread Simon Marlow
On 09/05/2014 19:21, Brandon Simmons wrote: A couple of updates: Edward Yang responded here, confirming the sort of track I was thinking on: http://blog.ezyang.com/2014/05/ghc-and-mutable-arrays-a-dirty-little-secret/ And I can report that: 1) cloning a frozen array doesn't provide the

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-12 Thread Brandon Simmons
On Mon, May 12, 2014 at 4:32 AM, Simon Marlow marlo...@gmail.com wrote: On 09/05/2014 19:21, Brandon Simmons wrote: A couple of updates: Edward Yang responded here, confirming the sort of track I was thinking on: http://blog.ezyang.com/2014/05/ghc-and-mutable-arrays-a-dirty-little-secret/

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-12 Thread Edward Z . Yang
Excerpts from Brandon Simmons's message of 2014-05-10 13:57:40 -0700: Another silly question: when card-marking happens after a write or CAS, does that indicate this segment maybe contains old-to-new generation references, so be sure to preserve (scavenge?) them from collection ? In my initial

Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Brandon Simmons
A couple of updates: Edward Yang responded here, confirming the sort of track I was thinking on: http://blog.ezyang.com/2014/05/ghc-and-mutable-arrays-a-dirty-little-secret/ And I can report that: 1) cloning a frozen array doesn't provide the benefits of creating a new array and freezing

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Edward Z . Yang
Hello Brandon, Excerpts from Brandon Simmons's message of 2014-05-08 16:18:48 -0700: I have an unusual application with some unusual performance problems and I'm trying to understand how I might use unsafeFreezeArray to help me, as well as understand in detail what's going on with boxed

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Brandon Simmons
On May 9, 2014 5:13 PM, Edward Z. Yang ezy...@mit.edu wrote: Hello Brandon, Excerpts from Brandon Simmons's message of 2014-05-08 16:18:48 -0700: I have an unusual application with some unusual performance problems and I'm trying to understand how I might use unsafeFreezeArray to help

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Carter Schonwald
Any chance you could try to use storable or unboxed vectors? On Friday, May 9, 2014, Brandon Simmons brandon.m.simm...@gmail.com wrote: On May 9, 2014 5:13 PM, Edward Z. Yang ezy...@mit.edujavascript:_e(%7B%7D,'cvml','ezy...@mit.edu'); wrote: Hello Brandon, Excerpts from Brandon

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Edward Z . Yang
Excerpts from Carter Schonwald's message of 2014-05-09 16:49:07 -0700: Any chance you could try to use storable or unboxed vectors? Neither of those will work if, at the end of the day, you need to store pointers to heap objects Edward ___

Re: Using mutable array after an unsafeFreezeArray, and GC details

2014-05-09 Thread Carter Schonwald
true enough On Fri, May 9, 2014 at 7:55 PM, Edward Z. Yang ezy...@mit.edu wrote: Excerpts from Carter Schonwald's message of 2014-05-09 16:49:07 -0700: Any chance you could try to use storable or unboxed vectors? Neither of those will work if, at the end of the day, you need to store

Using mutable array after an unsafeFreezeArray, and GC details

2014-05-08 Thread Brandon Simmons
I have an unusual application with some unusual performance problems and I'm trying to understand how I might use unsafeFreezeArray to help me, as well as understand in detail what's going on with boxed mutable arrays and GC. I'm using the interface from 'primitive' below. First some basic