17 Dec 11:33
Re: ForeignPtr performance
Simon Marlow <simonmarhaskell <at> gmail.com>
2007-12-17 10:33:19 GMT
2007-12-17 10:33:19 GMT
Bulat Ziganshin wrote: > Hello Scott, > > Sunday, December 16, 2007, 11:57:33 PM, you wrote: > >> My question is: what exactly does GHC.Prim.touch# do? This appears to > > it's a no-op (for ghc 6.6+ at least). its only task is to notify ghc > optimizer that data were accessed so it doesn't free the memory Yes, exactly. touch# generates no code, but it is vitally important because if the ForeignPtr is referencing data in the heap (like mallocForeignPtrBytes does), it prevents the data from being GC'd before the operation completes. Cheers, Simon
RSS Feed