Unchecked memory allocation and potential performance problem
Robert Latham
robl at mcs.anl.gov
Tue Dec 5 15:06:10 CST 2006
On Tue, Dec 05, 2006 at 08:57:26AM -0600, William Gropp wrote:
> In mpincio.c, there's this code
>
> const int bufsize = 4096;
> ...
> void *buf = malloc(bufsize);
> buf isn't checked for null before it is used.
I've fixed this in CVS.
> Also, the 4096 is used
> as the buffer size in MPI_File_read_at and similar calls (this seems
> rather small). Should this buffer size be negotiated? (I'm wondering
> if this might be a source of the slowdown that we're seeing, as this
> code can be invoked during a close).
I covered most of this in my reply to Katie's message. I don't know
what a good value would be for this: no matter how big we make it, if
the caller mucks with the header and forces us to shuffle all the bits
in the datafile, it's going to be slow. Additionally, both we and serial
netcdf strongly encourage everyone to do all their defining once, so
is it worth constructing a lot of negotiation infrastructure for a
hopefully infrequenlty used code path?
I could pick a larger yet still safe value for the bufsize. Maybe 1
MB?
==rob
--
Rob Latham
Mathematics and Computer Science Division A215 0178 EA2D B059 8CDF
Argonne National Lab, IL USA B29D F333 664A 4280 315B
More information about the parallel-netcdf
mailing list