Sizeof variables and Due's RAM

I set out to see how much space some arrays have. I used this test code

bool state = false;

uint16_t BuffA[46000];
uint16_t BuffB[20000];
uint16_t BuffC[20000];
uint16_t all = 0;

void setup(){
Serial.begin(9600);
}

void loop(){
if (state==false){
Serial.println(sizeof(BuffA));
Serial.println(sizeof(BuffB));
Serial.println(sizeof(BuffC));
all = sizeof(BuffA) + sizeof(BuffB) + sizeof(BuffC)
Serial.println(all);
state = true;
  }
}

I got this answer from the serial:

92000
40000
40000
40928
  1. Why are the results doubled from those i initiated? Shouldn't the first one be 46kb and the other two 20kb?
  2. Why is the last value only 40928?
  3. The RAM of Due is 96kb. Does this mean that with the initialization of only three arrays it's almost full? Ifi crossed the RAM limit, would the IDE throw an error?
  4. If i still need more RAM, can i use and external one with Due for high speed RAM acquisition?

1) sizeof returns the number of bytes an object contains, not the number of elements 2) because you ran this on a Uno?

You have arrays of type uint16_t, so each element occupies two bytes.

The sum of all sizes is 172000, which does not fit in a uint16_t. The value you see is 172000 modulo 65536 = 40928. Try putting the sum in a variable of type size_t, which is the type that sizeof returns.

Oops, yes, missed the summed datatype.

The size of contiguous SRAM is limited to 96 KB = 96 * 1024 = 98304 Bytes. The compiler should scream.

And yes, all needs to be declared as an uint32_t.