Hoogle Search
Within LTS Haskell 24.50 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
data
SmallArray# (a :: TYPE 'BoxedRep l)base GHC.Exts No documentation available.
data
SmallMutableArray# a (b :: TYPE 'BoxedRep l)base GHC.Exts No documentation available.
compactAllocateBlock# :: Word# -> Addr# -> State# RealWorld -> (# State# RealWorld, Addr# #)base GHC.Exts Attempt to allocate a compact block with the capacity (in bytes) given by the first argument. The Addr# is a pointer to previous compact block of the CNF or nullAddr# to create a new CNF with a single compact block. The resulting block is not known to the GC until compactFixupPointers# is called on it, and care must be taken so that the address does not escape or memory will be leaked.
currentCallStack :: IO [String]base GHC.Exts Returns a [String] representing the current call stack. This can be useful for debugging. The implementation uses the call-stack simulation maintained by the profiler, so it only works if the program was compiled with -prof and contains suitable SCC annotations (e.g. by using -fprof-auto). Otherwise, the list returned is likely to be empty or uninformative.
reallyUnsafePtrEquality :: a -> a -> Int#base GHC.Exts Compare the underlying pointers of two values for equality. Returns 1 if the pointers are equal and 0 otherwise. The two values must be of the same type, of kind Type. See also reallyUnsafePtrEquality#, which doesn't have such restrictions.
-
base GHC.Exts Resize a mutable array to new specified size. The returned SmallMutableArray# is either the original SmallMutableArray# resized in-place or, if not possible, a newly allocated SmallMutableArray# with the original content copied over. To avoid undefined behaviour, the original SmallMutableArray# shall not be accessed anymore after a resizeSmallMutableArray# has been performed. Moreover, no reference to the old one should be kept in order to allow garbage collection of the original SmallMutableArray# in case a new SmallMutableArray# had to be allocated.
setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorldbase GHC.Exts Sets the allocation counter for the current thread to the given value.
MallocPtr :: MutableByteArray# RealWorld -> !IORef Finalizers -> ForeignPtrContentsbase GHC.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)base GHC.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)base GHC.ForeignPtr This function is similar to mallocForeignPtrBytes, except that the size and alignment of the memory required is given explicitly as numbers of bytes.