Matthew Knepley <[email protected]> writes: > Actually, we are violating the malloc standard that Jed sent out. It says > that for 0 size, malloc must return > > NULL or a unique pointer > > However, if we have > > PetscMalloc2(0,&r1,1,&r2) > > then r1 == r2 with the optimized implementation, and the pointers are not > unique.
They are still correct to pass to PetscFree2(r1,r2). I thought the point of PetscMalloc[1-7] was to emulate doing a single big malloc and calculating offsets, not to be semantically identical to calling malloc several times (which would then allow separate calls to PetscFree).
pgprE5gUSY4wv.pgp
Description: PGP signature
