From dec3b22e8b977f8dcd39793bbac40c9c1a0d1e91 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <gonnet@google.com>
Date: Sun, 4 Dec 2016 22:51:36 +0100
Subject: [PATCH] add comment on the +100.

---
 src/space.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/space.c b/src/space.c
index e9cfe1cf4e..935677a9eb 100644
--- a/src/space.c
+++ b/src/space.c
@@ -454,7 +454,9 @@ void space_rebuild(struct space *s, int verbose) {
   struct cell *restrict cells_top = s->cells_top;
   const int ti_current = (s->e != NULL) ? s->e->ti_current : 0;
 
-  /* Run through the particles and get their cell index. */
+  /* Run through the particles and get their cell index. Allocates
+     an index that is larger than the number of particles to avoid
+     re-allocating after shuffling. */
   const size_t ind_size = s->size_parts + 100;
   int *ind;
   if ((ind = (int *)malloc(sizeof(int) * ind_size)) == NULL)
-- 
GitLab