doc/ja_JP.eucJP/man/man9/malloc.9
SUZUKI Koichi d100276457 Catch up with 5.3-BETA1 for man9.
Submitted by:   Akira Ikeuchi <a_ikeuchi@mic.mitsumi.co.jp>
Reviewed by:    Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2004-09-21 21:00:59 +00:00

304 lines
7.7 KiB
Groff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Paul Kranenburg.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
.\" %FreeBSD: src/share/man/man9/malloc.9,v 1.40 2004/06/21 14:11:45 mpp Exp %
.\" $FreeBSD$
.\"
.Dd June 12, 2003
.Dt MALLOC 9
.Os
.Sh ̾<EFBFBD><EFBFBD>
.Nm malloc ,
.Nm MALLOC ,
.Nm free ,
.Nm FREE ,
.Nm realloc ,
.Nm reallocf ,
.Nm MALLOC_DEFINE ,
.Nm MALLOC_DECLARE
.Nd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥ͡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ롼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.In sys/types.h
.In sys/malloc.h
.Ft void *
.Fn malloc "unsigned long size" "struct malloc_type *type" "int flags"
.Fn MALLOC space cast "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void
.Fn free "void *addr" "struct malloc_type *type"
.Fn FREE "void *addr" "struct malloc_type *type"
.Ft void *
.Fn realloc "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
.Ft void *
.Fn reallocf "void *addr" "unsigned long size" "struct malloc_type *type" "int flags"
.Fn MALLOC_DECLARE type
.In sys/param.h
.In sys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EFBFBD><EFBFBD>Τ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˻Ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD>뤿<EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD>Ѥ<EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD>Ǥ<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>פ<EFBFBD>
.Sq vmstat -m
<EFBFBD><EFBFBD>Ĵ<EFBFBD>٤뤳<EFBFBD>Ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
.Pp
.Fa type
<EFBFBD><EFBFBD>
.Fn MALLOC_DECLARE
<EFBFBD><EFBFBD>
.Fn MALLOC_DEFINE
<EFBFBD>ޥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><EFBFBD><EFBFBD>
.Vt "struct malloc_type"
typedef <20><><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
.Bd -literal -offset indent
/* sys/something/foo_extern.h */
MALLOC_DECLARE(M_FOOBUF);
/* sys/something/foo_main.c */
MALLOC_DEFINE(M_FOOBUF, "foobuffers",
"Buffers to foo data into the ether");
/* sys/something/foo_subr.c */
\&...
MALLOC(buf, struct foo_buf *, sizeof *buf, M_FOOBUF, M_NOWAIT);
.Ed
.Pp
.Fn MALLOC_DEFINE
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><EFBFBD>뤿<EFBFBD><EFBFBD><EFBFBD>ˤϡ<EFBFBD>
.In sys/param.h
.In ( sys/types.h
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.In sys/kernel.h
<EFBFBD>򥤥󥯥롼<EFBFBD>ɤ<EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Фʤ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Fn malloc ,
.Fn realloc ,
.Fn reallocf
<EFBFBD>ؿ<EFBFBD><EFBFBD>Ϥ<EFBFBD><EFBFBD>٤ƤΥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>פΥ<EFBFBD><EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥγ<EFBFBD>Ǽ<EFBFBD><EFBFBD>Ŭ<EFBFBD>ڤʤ褦<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󤵤줿
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͥ벾<EFBFBD>ۥ<EFBFBD><EFBFBD>ɥ쥹<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵᤬<EFBFBD><EFBFBD>­<EFBFBD>Ǥ<EFBFBD><EFBFB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