2004-09-28 04:34:51 -04:00
|
|
|
|
|
|
|
/*
|
2004-09-29 12:00:49 -04:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 04:34:51 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2004-06-06 15:49:18 -04:00
|
|
|
#ifndef _NGX_PALLOC_H_INCLUDED_
|
|
|
|
#define _NGX_PALLOC_H_INCLUDED_
|
2002-08-06 12:39:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
2003-06-03 11:42:58 -04:00
|
|
|
#include <ngx_core.h>
|
2002-08-06 12:39:45 -04:00
|
|
|
|
|
|
|
|
2003-10-23 03:13:16 -03:00
|
|
|
/*
|
2004-06-06 15:49:18 -04:00
|
|
|
* NGX_MAX_ALLOC_FROM_POOL should be (ngx_page_size - 1), i.e. 4095 on x86.
|
2004-09-28 04:34:51 -04:00
|
|
|
* On FreeBSD 5.x it allows to use the zero copy sending.
|
2003-11-25 17:44:56 -03:00
|
|
|
* On Windows NT it decreases a number of locked pages in a kernel.
|
2003-04-21 10:55:47 -04:00
|
|
|
*/
|
2004-06-06 15:49:18 -04:00
|
|
|
#define NGX_MAX_ALLOC_FROM_POOL (ngx_pagesize - 1)
|
2002-08-06 12:39:45 -04:00
|
|
|
|
|
|
|
#define NGX_DEFAULT_POOL_SIZE (16 * 1024)
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct ngx_pool_large_s ngx_pool_large_t;
|
2003-06-03 11:42:58 -04:00
|
|
|
|
2002-08-06 12:39:45 -04:00
|
|
|
struct ngx_pool_large_s {
|
|
|
|
ngx_pool_large_t *next;
|
|
|
|
void *alloc;
|
|
|
|
};
|
|
|
|
|
2003-06-03 11:42:58 -04:00
|
|
|
|
2002-08-06 12:39:45 -04:00
|
|
|
struct ngx_pool_s {
|
2005-02-03 16:33:37 -03:00
|
|
|
u_char *last;
|
|
|
|
u_char *end;
|
2002-08-06 12:39:45 -04:00
|
|
|
ngx_pool_t *next;
|
|
|
|
ngx_pool_large_t *large;
|
|
|
|
ngx_log_t *log;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void *ngx_alloc(size_t size, ngx_log_t *log);
|
|
|
|
void *ngx_calloc(size_t size, ngx_log_t *log);
|
|
|
|
|
|
|
|
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log);
|
|
|
|
void ngx_destroy_pool(ngx_pool_t *pool);
|
|
|
|
|
|
|
|
void *ngx_palloc(ngx_pool_t *pool, size_t size);
|
|
|
|
void *ngx_pcalloc(ngx_pool_t *pool, size_t size);
|
2004-09-23 02:32:00 -04:00
|
|
|
ngx_int_t ngx_pfree(ngx_pool_t *pool, void *p);
|
2003-10-23 03:13:16 -03:00
|
|
|
|
2002-08-06 12:39:45 -04:00
|
|
|
|
2004-06-06 15:49:18 -04:00
|
|
|
#endif /* _NGX_PALLOC_H_INCLUDED_ */
|