| Copyright | (c) The University of Glasgow 2001 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
System.Mem
Description
Memory-related system things.
performMajorGC ::IO ()Source#
Triggers an immediate major garbage collection.
Since: 4.7.0.0
performMinorGC ::IO ()Source#
Triggers an immediate minor garbage collection.
Since: 4.7.0.0
setAllocationCounter ::Int64 ->IO ()Source#
Every thread has an allocation counter that tracks how much memory has been allocated by the thread. The counter is initialized to zero, andsetAllocationCounter sets the current value. The allocation counter counts *down*, so in the absence of a call tosetAllocationCounter 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:
getAllocationCounter.enableAllocationLimit.Allocation accounting is accurate only to about 4Kbytes.
Since: 4.8.0.0
getAllocationCounter ::IOInt64Source#
Return the current value of the allocation counter for the current thread.
Since: 4.8.0.0
enableAllocationLimit ::IO ()Source#
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 theAllocationLimitExceeded 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, anotherAllocationLimitExceeded exception is sent, and so forth. Like other asynchronous exceptions, theAllocationLimitExceeded exception is deferred while the thread is insidemask or an exception handler incatch.
Note that memory allocation is unrelated tolive memory, also known asheap 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 onCPU time, rather than a limit on memory.
Compared to using timeouts, allocation limits don't count time spent blocked or in foreign calls.
Since: 4.8.0.0
disableAllocationLimit ::IO ()Source#
Disable allocation limit processing for the current thread.
Since: 4.8.0.0
Produced byHaddock version 2.20.0