Hoogle Search
Within LTS Haskell 24.67 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
pooledReallocArray :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a)ghc-internal GHC.Internal.Foreign.Marshal.Pool Adjust the size of an array in the given pool.
pooledReallocArray0 :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a)ghc-internal GHC.Internal.Foreign.Marshal.Pool Adjust the size of an array with an end marker in the given pool.
pooledReallocBytes :: Pool -> Ptr a -> Int -> IO (Ptr a)ghc-internal GHC.Internal.Foreign.Marshal.Pool Adjust the storage area for an element in the pool to the given size. Note that the previously allocated space is still retained in the same Pool and will only be freed when the entire Pool is freed.
MallocPtr :: MutableByteArray# RealWorld -> !IORef Finalizers -> ForeignPtrContentsghc-internal GHC.Internal.ForeignPtr The pointer refers to a byte array. The MutableByteArray# field means that the MutableByteArray# is reachable (by GC) whenever the ForeignPtr is reachable. When the ForeignPtr becomes unreachable, the runtime's normal GC recovers the memory backing it. Here, the finalizer function intended to be used to free() any ancillary *unmanaged* memory pointed to by the MutableByteArray#. See the zlib library for an example of this use.
- Invariant: The Addr# in the parent ForeignPtr is an interior pointer into this MutableByteArray#.
- Invariant: The MutableByteArray# is pinned, so the Addr# does not get invalidated by the GC moving the byte array.
- Invariant: A MutableByteArray# must not be associated with more than one set of finalizers. For example, this is sound:
incrGood :: ForeignPtr Word8 -> ForeignPtr Word8 incrGood (ForeignPtr p (MallocPtr m f)) = ForeignPtr (plusPtr p 1) (MallocPtr m f)
But this is unsound:incrBad :: ForeignPtr Word8 -> IO (ForeignPtr Word8) incrBad (ForeignPtr p (MallocPtr m _)) = do f <- newIORef NoFinalizers pure (ForeignPtr p (MallocPtr m f))
mallocForeignPtr :: Storable a => IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr Allocate some memory and return a ForeignPtr to it. The memory will be released automatically when the ForeignPtr is discarded. mallocForeignPtr is equivalent to
do { p <- malloc; newForeignPtr finalizerFree p }although it may be implemented differently internally: you may not assume that the memory returned by mallocForeignPtr has been allocated with malloc. GHC notes: mallocForeignPtr has a heavily optimised implementation in GHC. It uses pinned memory in the garbage collected heap, so the ForeignPtr does not require a finalizer to free the memory. Use of mallocForeignPtr and associated functions is strongly recommended in preference to newForeignPtr with a finalizer.mallocForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr This function is similar to mallocForeignPtrBytes, except that the size and alignment of the memory required is given explicitly as numbers of bytes.
mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr This function is similar to mallocForeignPtr, except that the size of the memory required is given explicitly as a number of bytes.
mallocPlainForeignPtr :: Storable a => IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr Allocate some memory and return a ForeignPtr to it. The memory will be released automatically when the ForeignPtr is discarded. GHC notes: mallocPlainForeignPtr has a heavily optimised implementation in GHC. It uses pinned memory in the garbage collected heap, as for mallocForeignPtr. Unlike mallocForeignPtr, a ForeignPtr created with mallocPlainForeignPtr carries no finalizers. It is not possible to add a finalizer to a ForeignPtr created with mallocPlainForeignPtr. This is useful for ForeignPtrs that will live only inside Haskell (such as those created for packed strings). Attempts to add a finalizer to a ForeignPtr created this way, or to finalize such a pointer, will throw an exception.
mallocPlainForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr This function is similar to mallocForeignPtrAlignedBytes, except that the internally an optimised ForeignPtr representation with no finalizer is used. Attempts to add a finalizer will cause an exception to be thrown.
mallocPlainForeignPtrBytes :: Int -> IO (ForeignPtr a)ghc-internal GHC.Internal.ForeignPtr This function is similar to mallocForeignPtrBytes, except that the internally an optimised ForeignPtr representation with no finalizer is used. Attempts to add a finalizer will cause an exception to be thrown.