.TH memok() "" "" "General Function (libc)"
.PC "Test if the arena is corrupted"
.B int
\fBmemok(\|);\fR
.PP
The library function
.B memok()
checks to see if the arena has been corrupted.
It returns one if the arena is sound, and zero if it
has been corrupted.
.SH "Example"
The following example purposely corrupts the arena, to demonstrate
.BR memok() .
Please note that this is not a recommended programming practice.
.DM
extern char *malloc();
main()
{
	char *p;
.DE
.DM
.ta 0.5i 3.0i
	p = malloc(2);	/* get 2 bytes of memory */
	printf("Arena is %s\en", memok() ? "OK" : "bad");
	strcpy(p, "too long");	/* clobber memory */
	printf("Arena is %s\en", memok() ? "OK" : "bad");
}
.DE
.SH "See Also"
.Xr "arena," arena
.Xr "calloc()," calloc
.Xr "libc," libc
.Xr "malloc()," malloc
.Xr "realloc()" realloc

