[Haskell-cafe] Array, Vector, Bytestring
Alfredo Di Napoli
alfredo.dinapoli at gmail.com
Wed Jul 10 11:20:57 CEST 2013
sorry for being unclear. What you say is correct, I was referring (and I
realised this after posting :D ) that the real
annoying thing is fragmentation in memory. Due to the fact the GC can't
move those objects, if we have long running
processes our memory will become more and more fragmented, correct? :(
On 10 July 2013 08:25, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On 10 July 2013 08:57, Alfredo Di Napoli <alfredo.dinapoli at gmail.com>
> >> To make the transition easier I have an experimental library which
> >> defines a ByteString as a type synonym of a Storable.Vector of Word8
> >> and provides the same interface as the bytestring package:
> >> https://github.com/basvandijk/vector-bytestring
> > That's interesting Bas. What bothers me about ByteStrings is that they
> > to be "pinned" inside the heap,
> > preventing the GC from collecting them.
> Being "pinned" doesn't prevent an object from being garbage collected.
> It just means that the GC won't move the object around so that foreign
> code can reliably reference the object while the GC is running:
> > I assume that working with vector remove the problem, correct?
> There wasn't a problem in the first but note that a Storable Vector is
> implemented in the same way as a ByteString: a ForeignPtr and a
> I hope I have now improved your sleep quality ;-)
> * A ByteString also contains an offset but vector modifies the pointer
> in the ForeignPtr instead so we safe an Int there.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe