Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shared memory

When creating shared memory, is the size declared the maximum total length of the array block or the size of each element in the array?

For example, in the following statements, is it correct to declare the size of 1 if the elements m1[0], m1[1], m1[2] are always set to an integer between 1 and 7.  ( i.e  m1[1]=1, m1[2]=7 ) or should the size declared be equal to the max size of all the elements in the array?

__SharedMemory sm2
int* m1=sm2.Create(F"Control {computerUserGM}" 1)

In case anyone is interested, the size refers to a memory block (4096) so doesn't matter if you declare 1 or 4096, it still allocates a minimum 4096. If you declare 4097, it will allocate 8192 since it always allocated in full blocks of 4096.

Forum Jump:

Users browsing this thread: 1 Guest(s)