summaryrefslogtreecommitdiff
path: root/libgo/runtime/chan.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/chan.c')
-rw-r--r--libgo/runtime/chan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/runtime/chan.c b/libgo/runtime/chan.c
index 24be9500a8b..db91d2c49ea 100644
--- a/libgo/runtime/chan.c
+++ b/libgo/runtime/chan.c
@@ -662,6 +662,10 @@ newselect(int32 size, Select **selp)
if(size > 1)
n = size-1;
+ // allocate all the memory we need in a single allocation
+ // start with Select with size cases
+ // then lockorder with size entries
+ // then pollorder with size entries
sel = runtime_mal(sizeof(*sel) +
n*sizeof(sel->scase[0]) +
size*sizeof(sel->lockorder[0]) +