Memory size issues with a pointers vector

Hi,

I have issues trying to program a data recorder on my Arduino Uno SMD. I just want to record short int in a pointers vector. That works fine if my vector size is less than approximatively 800. But if there's more elements than 800 (I'd like 1024), the program bug: I can compile and upload it but it seems to execute the setup() in a loop!?!
Did I made a stupid mistake (I'm a beginner)? Is it just that there's not enough memory available (but 1024 short int take just 2048 Bytes)?
Thanks,

Matthieu

Here's my code:

#include "Arduino.h"

int pinElectret=A1;

void setup ()
{
  Serial.begin(115200);
  Serial.println("Setup execution");
  delay(1000);
}
void loop()
{
 
  short* donnees[1024]  ;
  short val;
  int nbtot=1024;
 
  Serial.println("Start Recording");
  for(short int ip=0;ip<nbtot;ip=ip+1)
  {
    val=char(analogRead(pinElectret));
    donnees[ip]=&val;
    delayMicroseconds(1000);
    Serial.println(availableMemory());
  }
 
  Serial.println("End recording");
  Serial.println("Data:");
  for(short int ip=0;ip<nbtot;ip=ip+1)
  {
      Serial.println((short)*donnees[ip]);
    delayMicroseconds(1000);
  }
  Serial.println("Fin");
 
 
  delay(5000);
}

int availableMemory() 
{
  int size = 1024; // Use 2048 with ATmega328
  byte *buf;
  while ((buf = (byte *) malloc(--size)) == NULL);
  free(buf);

  return size;
}

Is it just that there's not enough memory available (but 1024 short int take just 2048kB)?

sp. "2048 bytes".
Remember, that's all the RAM you have.

I thought the arduino Uno has 32kB?

It has 32k program memory, aka ROM

Ok thanks that's my misunderstanding.