Overhead for shared memory

Hi there,

in my project, I allocate two lists in shared memory:

#define MAX 14


__shared__ int lst1[MAX*255]; //3,570

__shared__ int lst2[MAX];

All together, I end up with less than 4,000 bytes of used shared memory, correct?

Starting my application and looking into it with Nsight reveals that more than 14,000 bytes are in use.

To challenge this, I set MAX = 20 (5,100+14 = 5,114 bytes) and boom! wasn’t able to compile the project: “… too much shared data (0x5030 bytes + 0x10 bytes system, 0x4000 max)”

The message tells that I try to use 20,528 bytes of shared memory. But in fact, I am not …as far as I know.

Thanks for any hint on this.


Ints are 4 bytes, so lst1 consumes 4 * 14 * 255 = 14280 bytes, and lst2 consumes 56 bytes, or 14336 bytes combined.

Hi there,

some things are just sooo easy! :)

Thanks a lot for that hint!