Commit f805a9dc authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

resize memory after engine_split.


Former-commit-id: 1ebb6b5cbb85ba6c09c7e965db7c037d66af8570
parent 3da19ec1
......@@ -1774,6 +1774,20 @@ void engine_split ( struct engine *e , int *grid ) {
k -= 1;
}
}
/* Re-allocate the local parts. */
s->size_parts = s->nr_parts * 2;
struct part *parts_new;
struct xpart *xparts_new;
if ( posix_memalign( (void **)&parts_new , part_align , sizeof(struct part) * s->size_parts ) != 0 ||
posix_memalign( (void **)&xparts_new , part_align , sizeof(struct xpart) * s->size_parts ) != 0 )
error( "Failed to allocate new part data." );
memcpy( parts_new , s->parts , sizeof(struct part) * s->nr_parts );
memcpy( xparts_new , s->xparts , sizeof(struct xpart) * s->nr_parts );
free( s->parts );
free( s->xparts );
s->parts = parts_new;
s->xparts = xparts_new;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment