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.
setAllocationCounter :: Int64 -> IO ()base System.Mem Every thread has an allocation counter that tracks how much memory has been allocated by the thread. The counter is initialized to zero, and setAllocationCounter sets the current value. The allocation counter counts *down*, so in the absence of a call to setAllocationCounter its value is the negation of the number of bytes of memory allocated by the thread. There are two things that you can do with this counter:
- Use it as a simple profiling mechanism, with getAllocationCounter.
- Use it as a resource limit. See enableAllocationLimit.
data
SmallArray# (a :: TYPE 'BoxedRep l)base GHC.Base No documentation available.
data
SmallMutableArray# a (b :: TYPE 'BoxedRep l)base GHC.Base No documentation available.
compactAllocateBlock# :: Word# -> Addr# -> State# RealWorld -> (# State# RealWorld, Addr# #)base GHC.Base 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.
setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorldbase GHC.Base Sets the allocation counter for the current thread to the given value.
BlockedOnForeignCall :: BlockReasonbase GHC.Conc currently in a foreign call
-
base GHC.Conc Perform a series of STM actions atomically. Using atomically inside an unsafePerformIO or unsafeInterleaveIO subverts some of guarantees that STM provides. It makes it possible to run a transaction inside of another transaction, depending on when the thunk is evaluated. If a nested transaction is attempted, an exception is thrown by the runtime. It is possible to safely use atomically inside unsafePerformIO or unsafeInterleaveIO, but the typechecker does not rule out programs that may attempt nested transactions, meaning that the programmer must take special care to prevent these. However, there are functions for creating transactional variables that can always be safely called in unsafePerformIO. See: newTVarIO, newTChanIO, newBroadcastTChanIO, newTQueueIO, newTBQueueIO, and newTMVarIO. Using unsafePerformIO inside of atomically is also dangerous but for different reasons. See unsafeIOToSTM for more on this.
disableAllocationLimit :: IO ()base GHC.Conc Disable allocation limit processing for the current thread.
enableAllocationLimit :: IO ()base GHC.Conc Enables the allocation counter to be treated as a limit for the current thread. When the allocation limit is enabled, if the allocation counter counts down below zero, the thread will be sent the AllocationLimitExceeded asynchronous exception. When this happens, the counter is reinitialised (by default to 100K, but tunable with the +RTS -xq option) so that it can handle the exception and perform any necessary clean up. If it exhausts this additional allowance, another AllocationLimitExceeded exception is sent, and so forth. Like other asynchronous exceptions, the AllocationLimitExceeded exception is deferred while the thread is inside mask or an exception handler in catch. Note that memory allocation is unrelated to live memory, also known as heap residency. A thread can allocate a large amount of memory and retain anything between none and all of it. It is better to think of the allocation limit as a limit on CPU time, rather than a limit on memory. Compared to using timeouts, allocation limits don't count time spent blocked or in foreign calls.
getAllocationCounter :: IO Int64base GHC.Conc Return the current value of the allocation counter for the current thread.