# Could anyone can tell me why the operator in this code is '\>='?

**URL:** <https://www.ruby-forum.com/t/could-anyone-can-tell-me-why-the-operator-in-this-code-is/226311>\
**Category:** NGINX\
**Created:** [July 11, 2012, 4:01am UTC](https://www.ruby-forum.com/t/could-anyone-can-tell-me-why-the-operator-in-this-code-is/226311 "2012-07-11T04:01:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mogu0401](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mogu0401](https://www.ruby-forum.com/u/mogu0401)\
**Post date:** [July 11, 2012, 4:01am UTC](https://www.ruby-forum.com/t/could-anyone-can-tell-me-why-the-operator-in-this-code-is/226311/1 "2012-07-11T04:01:33Z")

</div>

ngx\_slab.c

void \*  
ngx\_slab\_alloc\_locked(ngx\_slab\_pool\_t \*pool, size\_t size)  
{  
size\_t s;  
uintptr\_t p, n, m, mask, \*bitmap;  
ngx\_uint\_t i, slot, shift, map;  
ngx\_slab\_page\_t \*page, \*prev, \*slots;

```
if (size >= ngx_slab_max_size) { // why not '>' ?

    ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0,
                   "slab alloc: %uz", size);

```

Posted at Nginx Forum:

> **[Could anyone can tell me why the operator in this code is '\>=' ?](https://forum.nginx.org/read.php?2,228488,228488#msg-228488)**
>
> ngx\_slab.c void \* ngx\_slab\_alloc\_locked(ngx\_slab\_pool\_t \*pool, size\_t size) { size\_t s; uintptr\_t p, n, m, mask, \*bitmap; ngx\_uint\_t i, slot, shift, map; ngx\_slab\_page\_t \*page, \*prev, \*slots;

---

<div class="post-metadata">

**Author:** ![mogu0401](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mogu0401](https://www.ruby-forum.com/u/mogu0401)\
**Post date:** [July 12, 2012, 9:50am UTC](https://www.ruby-forum.com/t/could-anyone-can-tell-me-why-the-operator-in-this-code-is/226311/2 "2012-07-12T09:50:48Z")

</div>

if a page size is 4096 bytes, then the ngx\_slab\_max\_size is 2048 bytes.  
When allocate 2048 bytes memory using nginx slab, it will get a total  
page. Is this a waste of memory?

please explain. thanks.

Posted at Nginx Forum:

> **[Re: Could anyone can tell me why the operator in this code is '\>=' ?](https://forum.nginx.org/read.php?2,228488,228531#msg-228531)**
>
> ngx\_slab.c void \* ngx\_slab\_alloc\_locked(ngx\_slab\_pool\_t \*pool, size\_t size) { size\_t s; uintptr\_t p, n, m, mask, \*bitmap; ngx\_uint\_t i, slot, shift, map; ngx\_slab\_page\_t \*page, \*prev, \*slots;
