diff --git a/src/proxy.c b/src/proxy.c index efe3a3eec108d44d5b9bf8b4718dc025464f8762..764448faa35c31036da017c158717e06f8c4da3d 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. */