From d8c53b32d3dc94fa6a75fbeec7e9b30c9a52e939 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Mon, 19 Dec 2016 15:13:31 +0100 Subject: [PATCH] align allocated pcells correctly. --- src/proxy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/proxy.c b/src/proxy.c index efe3a3eec1..764448faa3 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -65,8 +65,8 @@ void proxy_cells_exch1(struct proxy *p) { /* Allocate and fill the pcell buffer. */ if (p->pcells_out != NULL) free(p->pcells_out); - if ((p->pcells_out = malloc(sizeof(struct pcell) * p->size_pcells_out)) == - NULL) + if (posix_memalign((void **)&p->pcells_out, SWIFT_STRUCT_ALIGNMENT, + sizeof(struct pcell) * p->size_pcells_out) != 0) error("Failed to allocate pcell_out buffer."); for (int ind = 0, k = 0; k < p->nr_cells_out; k++) { memcpy(&p->pcells_out[ind], p->cells_out[k]->pcell, @@ -102,8 +102,8 @@ void proxy_cells_exch2(struct proxy *p) { /* Re-allocate the pcell_in buffer. */ if (p->pcells_in != NULL) free(p->pcells_in); - if ((p->pcells_in = (struct pcell *)malloc(sizeof(struct pcell) * - p->size_pcells_in)) == NULL) + if (posix_memalign((void **)p->pcells_in, SWIFT_STRUCT_ALIGNMENT, + sizeof(struct pcell) * p->size_pcells_in) != 0) error("Failed to allocate pcell_in buffer."); /* Receive the particle buffers. */ -- GitLab