  }
  
  
-@@ -263,7 +159,7 @@
+@@ -256,38 +152,48 @@
+ ngx_pmemalign(ngx_pool_t *pool, size_t size, size_t alignment)
+ {
+     void              *p;
+-    ngx_pool_large_t  *large;
++    ngx_pool_data_t   *d;
+ 
+     p = ngx_memalign(alignment, size, pool->log);
+     if (p == NULL) {
          return NULL;
      }
  
 -    large = ngx_palloc(pool, sizeof(ngx_pool_large_t));
-+    large = ngx_malloc(pool, sizeof(ngx_pool_large_t));
-     if (large == NULL) {
+-    if (large == NULL) {
++    d = ngx_alloc(sizeof(ngx_pool_data_t), pool->log);
++    if (d == NULL){
          ngx_free(p);
          return NULL;
-@@ -278,16 +174,27 @@
+     }
+ 
+-    large->alloc = p;
+-    large->next = pool->large;
+-    pool->large = large;
+-
++    d->alloc = p;
++    d->next = pool->d;
++    pool->d = d;
+     return p;
+ }
  
  
  ngx_int_t

-
-    pool->current = current ? current : new;
-
+    new->alloc = m;
+    new->next = pool->d;
+    pool->d = new;
     return m;
 }
 
 

-        if (p->d.failed++ > 4) {
-            current = p->d.next;
-        }
+    d = ngx_alloc(sizeof(ngx_pool_data_t), pool->log);
+    if (d == NULL){
+        ngx_free(p);
+        return NULL;
     }
 
