JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... g malloc_info (3) instead. The returned structure is defined as follows: struct mallinfo { int arena; /* Non-mmapped space allocated (bytes) */ int ordblks; /* Number of free chunks */ int smblks; /* Number of free fastbin blocks */ int hblks; /* Number o ... f mmapped regions */ int hblkhd; /* Space allocated in mmapped regions (bytes) */ int usmblks; /* See below */ int fsmblks; /* Space in freed fastbin blocks (bytes) */ int uo ... rdblks; /* Total allocated space (bytes) */ int fordblks; /* Total free space (bytes) */ int keepcost; /* Top-most, releasable space (bytes) */ }; ma ... ... ude < string.h > #define INIT_BUF_SIZE 4 struct memfile_cookie { char *buf; /* Dynamically sized buffer for data */ size_t allocated; /* Size of buf */ size_t endpos; /* Number of characters in buf */ off_t offset; /* Current file offset in buf */ }; ssiz ... ile_cookie *cookie = c; /* Buffer too small? Keep doubling size until big enough */ while (size + cookie->offset > cookie->allocated) { new_buff = realloc(cookie->buf, cookie->allocated * 2); if (new_buff == NULL) { return -1; } else { cookie->allocated * ... ffset = new_offset; return 0; } int memfile_close(void *c) { struct memfile_cookie *cookie = c; free(cookie->buf); cookie->allocated = 0; cookie->buf = NULL; return 0; } int main(int argc, char *argv[]) { cookie_io_functions_t memfile_func = { .read = mem ... ... い。 The calloc () function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc () returns either NULL, or a unique pointer value th ... uld not be detected in the following call to malloc (), with the result that an incorrectly sized block of memory would be allocated: malloc(nmemb * size); realloc () は、ポインター ptr が示すメモリーブロックのサイズを size バイト に変更する。領域の先頭か ... ) が成功した場合にも NULL が返される。 free () 関数は値を返さない。 The realloc () function returns a pointer to the newly allocated memory, which is suitably aligned for any built-in type, or NULL if the request failed. The returned pointer may be the sa ... ... い。 The calloc () function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc () returns either NULL, or a unique pointer value th ... uld not be detected in the following call to malloc (), with the result that an incorrectly sized block of memory would be allocated: malloc(nmemb * size); realloc () は、ポインター ptr が示すメモリーブロックのサイズを size バイト に変更する。領域の先頭か ... ) が成功した場合にも NULL が返される。 free () 関数は値を返さない。 The realloc () function returns a pointer to the newly allocated memory, which is suitably aligned for any built-in type, or NULL if the request failed. The returned pointer may be the sa ... ... い。 The calloc () function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc () returns either NULL, or a unique pointer value th ... uld not be detected in the following call to malloc (), with the result that an incorrectly sized block of memory would be allocated: malloc(nmemb * size); realloc () は、ポインター ptr が示すメモリーブロックのサイズを size バイト に変更する。領域の先頭か ... ) が成功した場合にも NULL が返される。 free () 関数は値を返さない。 The realloc () function returns a pointer to the newly allocated memory, which is suitably aligned for any built-in type, or NULL if the request failed. The returned pointer may be the sa ... ... い。 The calloc () function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc () returns either NULL, or a unique pointer value th ... uld not be detected in the following call to malloc (), with the result that an incorrectly sized block of memory would be allocated: malloc(nmemb * size); realloc () は、ポインター ptr が示すメモリーブロックのサイズを size バイト に変更する。領域の先頭か ... ) が成功した場合にも NULL が返される。 free () 関数は値を返さない。 The realloc () function returns a pointer to the newly allocated memory, which is suitably aligned for any built-in type, or NULL if the request failed. The returned pointer may be the sa ... ... い。 The calloc () function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc () returns either NULL, or a unique pointer value th ... uld not be detected in the following call to malloc (), with the result that an incorrectly sized block of memory would be allocated: malloc(nmemb * size); realloc () は、ポインター ptr が示すメモリーブロックのサイズを size バイト に変更する。領域の先頭か ... ) が成功した場合にも NULL が返される。 free () 関数は値を返さない。 The realloc () function returns a pointer to the newly allocated memory, which is suitably aligned for any built-in type, or NULL if the request failed. The returned pointer may be the sa ... ... 開する。機能検査マクロは不要である。 説明 The function posix_memalign () allocates size bytes and places the address of the allocated memory in *memptr . The address of the allocated memory will be a multiple of alignment , which must be a power of two and ... れもメモリーのゼロクリアを行わない。 返り値 aligned_alloc (), memalign (), valloc (), and pvalloc () return a pointer to the allocated memory on success. On error, NULL is returned, and errno is set to indicate the cause of the error. posix_memalign () retu ... ... 開する。機能検査マクロは不要である。 説明 The function posix_memalign () allocates size bytes and places the address of the allocated memory in *memptr . The address of the allocated memory will be a multiple of alignment , which must be a power of two and ... れもメモリーのゼロクリアを行わない。 返り値 aligned_alloc (), memalign (), valloc (), and pvalloc () return a pointer to the allocated memory on success. On error, NULL is returned, and errno is set to indicate the cause of the error. posix_memalign () retu ... ... 開する。機能検査マクロは不要である。 説明 The function posix_memalign () allocates size bytes and places the address of the allocated memory in *memptr . The address of the allocated memory will be a multiple of alignment , which must be a power of two and ... れもメモリーのゼロクリアを行わない。 返り値 aligned_alloc (), memalign (), valloc (), and pvalloc () return a pointer to the allocated memory on success. On error, NULL is returned, and errno is set to indicate the cause of the error. posix_memalign () retu ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。