Help with shared memory usage

Wandenberg Peixoto wandenberg at gmail.com
Sat Jun 29 01:36:39 UTC 2013


Hi,

I'm trying to understand how the shared memory pool works inside the Nginx.
To do that, I made a very small module which create a shared memory zone
with 2097152 bytes,
and allocating and freeing blocks of memory, starting from 0 and increasing
by 1kb until the allocation fails.

The strange parts to me were:
- the maximum block I could allocate was 128000 bytes
- each time the allocation fails, I started again from 0, but the maximum
allocated block changed with the following profile
128000
87040
70656
62464
58368
54272
50176
46080
41984
37888
33792
29696

This is the expected behavior?
Can anyone help me explaining how shared memory works?
I have another module which do an intensive shared memory usage, and
understanding this can help me improve it solving some "no memory" messages.

I put the code in attach.

Thanks,
Wandenberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130628/1b6a7254/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-shm-fragmentation-module.tar.gz
Type: application/x-gzip
Size: 2063 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20130628/1b6a7254/attachment.bin>


More information about the nginx-devel mailing list