The test has been run on a custom board which is very similar to the BF-561-EZ-Kit.

Tests that have been run....

top - Note the available ram and amount of cache.

ipcs - View the number of shared memory segments and sizes.

shared_test - Do NOT press enter.

top - Note the available ram and amount of cache.

ipcs - View the number of shared memory segments and sizes.

shared_test - Now press enter.

top - Note the available ram and amount of cache.

ipcs - View the number of shared memory segments and sizes.

Output from test run:

Before:

Mem: 13120K used, 49336K free, 0K shrd, 0K buff, 6196K cached

During:

Mem: 21524K used, 40932K free, 0K shrd, 0K buff, 14004K cached

After:

Mem: 20956K used, 41500K free, 0K shrd, 0K buff, 6212K cached

sync; echo 3 > /proc/sys/vm/drop_caches

Mem: 20820K used, 41636K free, 0K shrd, 0K buff, 6196K cached

I also compiled the same project for linux and tested.

I do not at all see the same behavior in linux.

Any further suggestions?

Cheers,

//Alf

shared_test.tar.gz

QuoteReplyEditDelete

2011-03-03 01:58:51 Re: Delete shared memory.

Mike Frysinger (UNITED STATES)

Message: 98619

there does seem to be a small memory leak, but i dont think it's a matter of the shared mem not being deleted. looks more like some internal structures are not being released when the shared memory segments are freed.

your test can be further reduced down. simply call shmget() followed by shmctl(IPC_RMID).