Skip to content
Snippets Groups Projects
Commit c2ef200e authored by Simon Marlow's avatar Simon Marlow Committed by Austin Seipp
Browse files

fix comment on allocate() (#8254)

(cherry picked from commit 68c0d868)
parent c0da98f8
No related merge requests found
...@@ -662,20 +662,22 @@ move_STACK (StgStack *src, StgStack *dest) ...@@ -662,20 +662,22 @@ move_STACK (StgStack *src, StgStack *dest)
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
allocate() StgPtr allocate (Capability *cap, W_ n)
This allocates memory in the current thread - it is intended for Allocates an area of memory n *words* large, from the nursery of
use primarily from STG-land where we have a Capability. It is the supplied Capability, or from the global block pool if the area
better than allocate() because it doesn't require taking the requested is larger than LARGE_OBJECT_THRESHOLD. Memory is not
sm_mutex lock in the common case. allocated from the current nursery block, so as not to interfere
with Hp/HpLim.
Memory is allocated directly from the nursery if possible (but not
from the current nursery block, so as not to interfere with The address of the allocated memory is returned. allocate() never
Hp/HpLim). fails; if it returns, the returned value is a valid address. If
the nursery is already full, then another block is allocated from
the global block pool. If we need to get memory from the OS and
that operation fails, then the whole process will be killed.
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
StgPtr StgPtr allocate (Capability *cap, W_ n)
allocate (Capability *cap, W_ n)
{ {
bdescr *bd; bdescr *bd;
StgPtr p; StgPtr p;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment