1. petsc
  2. PETSc
  3. petsc
  4. Issues
Issue #31 new

Add PetscRealloc

Jed Brown
created an issue

The realloc function allows the operating system to optionally reuse existing memory. Adding support in PETSc, but it expands the allocation API and logging will need to be taught to detect and expand such memory locations.

Comments (2)

  1. Jed Brown reporter

    It is less code and less expensive when buffers need to be expanded in dynamic data structures. PETSc usually uses special "freespace" components to guarantee that reallocation does not occur, but sometimes you want the result to be contiguous.

    But more importantly than performance, the leading motivation is convenience. As it is, a lot of users will call system realloc out of convenience, thus giving up the profiling capability and leak checking of PetscMalloc.

  2. Log in to comment