[petsc-users] malloc

Jed Brown jed at jedbrown.org
Thu Mar 13 09:22:53 CDT 2014


吕超 <luchao at mail.iggcas.ac.cn> writes:

> Your faithfully:
>
>     I use malloc

I presume you mean PetscMalloc.

>     to allocate memories to 1d or 2d array, if I use function
>     free(array), error "Caught signal number 11 SEGV: Segmentation
>     Violation, probably memory access out of range" always appear,.
>
>      However, if I use PetscFree(array), there are no errors? could do
>      you please tell me why?

The interface requires you to use PetscFree with PetscMallic.

PetscMalloc has some debugging/alignment features by default, so you
can't just pass the pointer to free().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140313/99dfc220/attachment.pgp>


More information about the petsc-users mailing list