From: Jarkko Hietaniemi Date: Sat, 20 Jan 2001 22:50:05 +0000 (+0000) Subject: Memory management calls documentation. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d1fbc991cdaf266fb65adfbe247dcc2375d342b;p=p5sagit%2Fp5-mst-13.2.git Memory management calls documentation. p4raw-id: //depot/perl@8492 --- diff --git a/pod/perlguts.pod b/pod/perlguts.pod index f38bba3..924e993 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1357,17 +1357,27 @@ function). Here is a handy table of equivalents between ordinary C and Perl's memory abstraction layer: - Instead Of: Use: - - malloc New - calloc Newz - realloc Renew - memcopy Copy - memmove Move - free Safefree - strdup savepv - strndup savepvn (Hey, strndup doesn't exist!) - memcpy/*(struct foo *) StructCopy + Instead Of: Use: + + t* p = malloc(n) New(id, p, n, t) + t* p = calloc(n, s) Newz(id, p, n, t) + p = realloc(p, n) Renew(p, n, t) + memcpy(dst, src, n) Copy(src, dst, n, t) + memmove(dst, src, n) Move(src, dst, n, t) + free(p) Safefree(p) + strdup(p) savepv(p) + strndup(p, n) savepvn(p, n) (Hey, strndup doesn't exist!) + memcpy/*(struct foo *) StructCopy(src, dst, t) + + t type + p pointer + ck cookie for the memory region (now unused) + n number of elements + src source pointer + dst destination pointer + +Notice the different order of arguments to C and C than used +in C and C. =head2 PerlIO