summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-02-27 12:37:32 +0000
committerSimon Marlow <marlowsd@gmail.com>2014-02-27 12:37:32 +0000
commit68c0d8689dd93cb0ce74a288e82f2ed997c31acc (patch)
tree88546a54e00053768e5f86838bff5424620d6339 /rts
parentb1ddec1e6d4695d71d38b59db26829d71ad784e1 (diff)
downloadhaskell-68c0d8689dd93cb0ce74a288e82f2ed997c31acc.tar.gz
fix comment on allocate() (#8254)
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/Storage.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index df5f4b3e6d..86bd1c2bb3 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -662,20 +662,22 @@ move_STACK (StgStack *src, StgStack *dest)
}
/* -----------------------------------------------------------------------------
- allocate()
-
- This allocates memory in the current thread - it is intended for
- use primarily from STG-land where we have a Capability. It is
- better than allocate() because it doesn't require taking the
- sm_mutex lock in the common case.
-
- Memory is allocated directly from the nursery if possible (but not
- from the current nursery block, so as not to interfere with
- Hp/HpLim).
+ StgPtr allocate (Capability *cap, W_ n)
+
+ Allocates an area of memory n *words* large, from the nursery of
+ the supplied Capability, or from the global block pool if the area
+ requested is larger than LARGE_OBJECT_THRESHOLD. Memory is not
+ allocated from the current nursery block, so as not to interfere
+ with Hp/HpLim.
+
+ The address of the allocated memory is returned. allocate() never
+ 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
-allocate (Capability *cap, W_ n)
+StgPtr allocate (Capability *cap, W_ n)
{
bdescr *bd;
StgPtr p;