* このページを編集する際は,[[編集に関する方針>編集方針]]に従ってください. [#z1b18a3b]

* 概要 [#j7980619]
- [[Jabberd14-1.6.0/jabberd/lib/pool.c]]にて定義

  * try to allocate memory
  *
  * If allocation fails, it will be retries for MAX_MALLOC_TRIES seconds.
  * If it still fails, we exit the process

* 引数 [#p3f21dd6]
  * @param size how many bytes of memory we allocate
  * @return pointer to the allocated memory

* 実装 [#v0d545ab]

 #define MAX_MALLOC_TRIES 10 /**< how many seconds we try to allocate memory */

 inline void *_retried__malloc(size_t size) {
     void *allocated_memory;
     int malloc_tries = 0;

     while ((allocated_memory=_pool__malloc(size)) == NULL) {
	 if (malloc_tries++ > MAX_MALLOC_TRIES) {
	     exit(999);
	 }

	 pth_sleep(1);
     }

     return allocated_memory;
 }

* 呼出元 [#rfeda7ab]
[[Jabberd14-1.6.0/jabberd/lib/pool.c/pmalloc]]
[[Jabberd14-1.6.0/jabberd/lib/pool.c/_pool_free]]

#related