Memory allocation issue

I’m writing a block that requires a large amount of data to be processed
in one iteration of the work function. If I call set_output_multiple()
with 8100 * 130 = 1053000 items (of gr_complex), I get the following
error:

gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::buffer::allocate_buffer: failed to allocate buffer of size 16456 KB
gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
gr::buffer::allocate_buffer: failed to allocate buffer of size 16456 KB
terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc

I realize that 16 Megabytes is a little large, but not astronomical.
The set_output_multiple() function does work fine with 8100 * 129
= 1044900 items (of gr_complex).

Is this some hard limitation in the shared memory library, or can it be
overridden somehow?

best regards,
Ron

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ron,
yep, that can be, within kernel-caused and total memory boundaries be
configured to your heart’s delight:

echo $(( 1024 * 1024 * 1024 )) > /proc/sys/kernel/shmmax

to set the maximum size shared mem buffer to 1GB.

Greetings,
Marcus

On 21.10.2014 18:12, Ron E. wrote:

gr::vmcircbuf_sysv_shm: shmget(1): Invalid argument
Is this some hard limitation in the shared memory library, or can
it be overridden somehow?

best regards, Ron

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
Discuss-gnuradio Info Page
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJURoevAAoJEAFxB7BbsDrLZxQH/0L9Eq9YAeSCdkwKcxDtp58l
6kuHH+HZYHodOTxJBqlKG123Avnqr0nzCc13GAOXvRiq8ooVHrsyEOfGQooCzF8o
yqlTNQzdxN86blnaW3Gb0BaDfIIvKWF5Q/DJHLagTsLMvKfcYRj7ke7wEge+tflJ
YmAhcSUNqhxKyScbCkOShQMsdZcCgeirV0kkFkk2rqdMmdtSOTy7Cs/WMM0UCeP5
zzIuBstRac/7Sax+SY88OF9IUHzlspKzY/MpqDk+RxcHWcA+u+EXBsgO3oSVjRl+
grakLDtJBn5o95YLeRuxdSxHmRDiD6Uvuy/8MLoB78vcMWZi8S70k8SekQU8bAY=
=h8wJ
-----END PGP SIGNATURE-----

Ron,

See if you can set kernel.shmmax to something higher. You can check the
current value with

sysctl kernel.shmmax

See sysctl(8).

Jeff

Marcus and Jeff,

 Works great. Thanks guys. BTW, the default on my Ubuntu 13.10 

system
was 33,554,432 bytes.

best regards,
Ron

Hi Ron,

Yes, that seems to be linux kernel default:

$>cd /usr/src/kernels/3.14.19*
$>grep -REo
‘^[[:space:]]*#define[[:space:]]+SHMMAX[[:space:]]+0x[0-9a-f]+’
include/uapi/linux/shm.h:#define SHMMAX 0x2000000
$>echo $((0x2000000))
33554432

Cheers,
Marcus

PS: help, I’m being helped captive in a bad-regex factory. They feed us
mail addresses!