--- src/core/ngx_slab.c	2013-05-06 07:27:10.000000000 -0300
+++ src/core/ngx_slab.c	2013-07-27 15:54:55.316995223 -0300
@@ -687,6 +687,25 @@ ngx_slab_free_pages(ngx_slab_pool_t *poo
     page->next->prev = (uintptr_t) page;
 
     pool->free.next = page;
+
+    for (page = pool->pages; ((page->slab > 0) && (&page[page->slab] < (ngx_slab_page_t *) (pool->start - sizeof(ngx_slab_page_t))));) {
+        ngx_slab_page_t *neighbour = &page[page->slab];
+        if (((ngx_slab_page_t *) page->prev != NULL) && (page->next != NULL) && ((page->prev & NGX_SLAB_PAGE_MASK) == NGX_SLAB_PAGE) &&
+            ((ngx_slab_page_t *) neighbour->prev != NULL) && (neighbour->next != NULL) && ((neighbour->prev & NGX_SLAB_PAGE_MASK) == NGX_SLAB_PAGE)) {
+
+            page->slab += neighbour->slab;
+
+            ((ngx_slab_page_t *) neighbour->prev)->next = neighbour->next;
+            neighbour->next->prev = neighbour->prev;
+
+            neighbour->slab = NGX_SLAB_PAGE_FREE;
+            neighbour->prev = (uintptr_t) &pool->free;
+            neighbour->next = &pool->free;
+            continue;
+        }
+
+        page += ((page->prev & NGX_SLAB_PAGE_MASK) == NGX_SLAB_PAGE) ? page->slab : 1;
+    }
 }
 
 
