From e1cb9c85f5aa02d65974446821fb2cc4185bc243 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Wed, 27 Mar 2019 15:03:06 +0000 Subject: [PATCH] Better memory labelling --- src/parallel_io.c | 4 ++-- src/serial_io.c | 4 ++-- src/single_io.c | 4 ++-- src/space.c | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/parallel_io.c b/src/parallel_io.c index e654724587..0160a53c11 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -473,7 +473,7 @@ void writeArray_chunk(struct engine* e, hid_t h_data, /* Allocate temporary buffer */ void* temp = NULL; - if (swift_memalign("writetemp", (void**)&temp, IO_BUFFER_ALIGNMENT, + if (swift_memalign("writebuff", (void**)&temp, IO_BUFFER_ALIGNMENT, num_elements * typeSize) != 0) error("Unable to allocate temporary i/o buffer"); @@ -557,7 +557,7 @@ void writeArray_chunk(struct engine* e, hid_t h_data, #endif /* Free and close everything */ - swift_free("writetemp", temp); + swift_free("writebuff", temp); H5Sclose(h_memspace); H5Sclose(h_filespace); } diff --git a/src/serial_io.c b/src/serial_io.c index dc30f3007c..55a468411b 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -365,7 +365,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, /* Allocate temporary buffer */ void* temp = NULL; - if (swift_memalign("writetemp", (void**)&temp, IO_BUFFER_ALIGNMENT, + if (swift_memalign("writebuff", (void**)&temp, IO_BUFFER_ALIGNMENT, num_elements * typeSize) != 0) error("Unable to allocate temporary i/o buffer"); @@ -416,7 +416,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, if (h_err < 0) error("Error while writing data array '%s'.", props.name); /* Free and close everything */ - swift_free("writetemp", temp); + swift_free("writebuff", temp); H5Dclose(h_data); H5Sclose(h_memspace); H5Sclose(h_filespace); diff --git a/src/single_io.c b/src/single_io.c index b770ef95a0..917dd88049 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -241,7 +241,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, /* Allocate temporary buffer */ void* temp = NULL; - if (swift_memalign("writetemp", (void**)&temp, IO_BUFFER_ALIGNMENT, + if (swift_memalign("writebuff", (void**)&temp, IO_BUFFER_ALIGNMENT, num_elements * typeSize) != 0) error("Unable to allocate temporary i/o buffer"); @@ -333,7 +333,7 @@ void writeArray(const struct engine* e, hid_t grp, char* fileName, io_write_attribute_s(h_data, "Conversion factor", buffer); /* Free and close everything */ - swift_free("writetemp", temp); + swift_free("writebuff", temp); H5Pclose(h_prop); H5Dclose(h_data); H5Sclose(h_space); diff --git a/src/space.c b/src/space.c index 9f53b68397..ac6ee227df 100644 --- a/src/space.c +++ b/src/space.c @@ -313,17 +313,17 @@ void space_free_foreign_parts(struct space *s) { #ifdef WITH_MPI if (s->parts_foreign != NULL) { - free(s->parts_foreign); + swift_free("parts_foreign", s->parts_foreign); s->size_parts_foreign = 0; s->parts_foreign = NULL; } if (s->gparts_foreign != NULL) { - free(s->gparts_foreign); + swift_free("gparts_foreign", s->gparts_foreign); s->size_gparts_foreign = 0; s->gparts_foreign = NULL; } if (s->sparts_foreign != NULL) { - free(s->sparts_foreign); + swift_free("sparts_foreign", s->sparts_foreign); s->size_sparts_foreign = 0; s->sparts_foreign = NULL; } @@ -2277,7 +2277,7 @@ void space_parts_sort(struct part *parts, struct xpart *xparts, ptrdiff_t parts_offset) { /* Create the offsets array. */ size_t *offsets = NULL; - if (swift_memalign("offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, + if (swift_memalign("parts_offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, sizeof(size_t) * (num_bins + 1)) != 0) error("Failed to allocate temporary cell offsets array."); @@ -2322,7 +2322,7 @@ void space_parts_sort(struct part *parts, struct xpart *xparts, error("Bad offsets after shuffle."); #endif /* SWIFT_DEBUG_CHECKS */ - swift_free("offsets", offsets); + swift_free("parts_offsets", offsets); } /** @@ -2340,7 +2340,7 @@ void space_sparts_sort(struct spart *sparts, int *restrict ind, ptrdiff_t sparts_offset) { /* Create the offsets array. */ size_t *offsets = NULL; - if (swift_memalign("offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, + if (swift_memalign("sparts_offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, sizeof(size_t) * (num_bins + 1)) != 0) error("Failed to allocate temporary cell offsets array."); @@ -2382,7 +2382,7 @@ void space_sparts_sort(struct spart *sparts, int *restrict ind, error("Bad offsets after shuffle."); #endif /* SWIFT_DEBUG_CHECKS */ - swift_free("offsets", offsets); + swift_free("sparts_offsets", offsets); } /** @@ -2400,7 +2400,7 @@ void space_gparts_sort(struct gpart *gparts, struct part *parts, int *restrict counts, int num_bins) { /* Create the offsets array. */ size_t *offsets = NULL; - if (swift_memalign("offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, + if (swift_memalign("gparts_offsets", (void **)&offsets, SWIFT_STRUCT_ALIGNMENT, sizeof(size_t) * (num_bins + 1)) != 0) error("Failed to allocate temporary cell offsets array."); @@ -2448,7 +2448,7 @@ void space_gparts_sort(struct gpart *gparts, struct part *parts, error("Bad offsets after shuffle."); #endif /* SWIFT_DEBUG_CHECKS */ - swift_free("offsets", offsets); + swift_free("gparts_offsets", offsets); } /** -- GitLab