user37577: I've written some Arduino Code which kept crashing and i couldn't find out why. Then i reduced the code as much as i could in order to see the problem. 
The reduced code currently doesn't do anything extraordinary except printing some strings over the serial line.
This is the reduced code: 
void setup() 
{
  Serial.begin(9600);
  Serial.print("Begin\r\n");
  send_wifi_beacon();
}
void loop()
{  
  delay(1000);
}
void send_wifi_beacon()
{
  send_wlan_chip_command("AT+CIFSR");
  Serial.print("notreached"); // this part is never reached
  send_data_over_network(); // can't remove this line otherwise the crash won't happen which is weird since this is never called
}
void read_response_from_serial()
{  
  delay(2000);
  Serial.print("==-1\r\n"); // crashes here
}
void send_wlan_chip_command(char* command)
{
  Serial.print("Sending command to wifi module: ");
  Serial.print(command);
  read_response_from_serial();
  Serial.print("Command response: ");
}
// this function is never called, since the crash happens before the call, but it can't be removed otherwise the crash won't happen
// also it can't  be altered then, the crash also will not happen.
void send_data_over_network()
{
  char number[3] = "12";
  //char number[3] = "";
  char length_of_payload[20] = "0123456789012345678"; // 20 digits if assuming 64 bit integer is the maximum this code will ever run on
//  char length_of_payload[20] = "";
  char *command;

  command = malloc(26);
  command = "AT+CIPSSEND";
  strcat(command, number);
  strcat(command, ",");
  strcat(command, length_of_payload);
  send_wlan_chip_command(command);
  free(command);
}

This is the according output:

Begin Sending command to wifi module: AT+CIFSR==Begin
  Sending command to wifi module: AT+CIFSR==Begin
  Sending command to wifi module: AT+CIFSR==Begin
  Sending command to wifi module: AT+CIFSR==Begin  

Which means that the arduino keeps crashing and resetting. This goes on forever.
The weird thing is, if I change the following two lines to: (in the"send_data_over_network" function as in example above)
char number[3] = "1"; // changed from => char number[3] = "";
char length_of_payload[20] = "123"; // changed from => char length_of_payload[20] = "0123456789012345678";

The output now changes to : 

I call this behaviour weird since it shouldn't have any influence on the result because this function(send_data_over_network) is never called in the crash example from before.
Troubleshooting options i already tried:

Reinstalling Arduino IDE , i tried with mutliple versions 1.8 , 1.6, 1.4. 1.0
Different Arduino Boards (Arduino Uno and Arduino Mega)
Different Laptops (since i thought maybe it's related to power issues of my laptop)

Maybe it's something obvious and i just can't see it, but i already spent +16h debugging, so help would be really appreciated.

user31105: This code looks wrong:
  command = malloc(26);
  command = "AT+CIPSSEND";
  strcat(command, number);
  strcat(command, ",");
  strcat(command, length_of_payload);
  send_wlan_chip_command(command);

First you allocate 26 bytes, then a new string is created, which you strcat to it. This happens in memory that is not allocated (or overwrites other data).
Instead of 
  command = "AT+CIPSSEND";

use
  strcpy(command, "AT+CIPSSEND");

Also check that 26 bytes is enough, change it to 128 bytes to be sure (check the correct amount you need later).

user28658: You are almost certainly running out of memory and have a stack collision with the heap. Dynamic memory allocation and de-allocation is not a good idea when you have less than 2K RAM to work with. If you use malloc() use it only to allocate buffer space and then reuse the buffers. Put your test code entirely in setup and see what happens. Also check the amount of RAM allocated at compile time it may be more than you think.
char *buf1;
char *buf2;

void setup() {
   buf1 = (char *) malloc(10);
   buf2 = (char *) malloc(10);
   .
   .
   // test code here
}


37577: <p>I've written some Arduino Code which kept crashing and i couldn't find out why. Then i reduced the code as much as i could in order to see the problem. 
The reduced code currently doesn't do anything extraordinary except printing some strings over the serial line.</p>

<p><strong>This is the reduced code:</strong> </p>

<pre><code>void setup() 
{
  Serial.begin(9600);
  Serial.print("Begin\r\n");
  send_wifi_beacon();
}
void loop()
{  
  delay(1000);
}
void send_wifi_beacon()
{
  send_wlan_chip_command("AT+CIFSR");
  Serial.print("notreached"); // this part is never reached
  send_data_over_network(); // can't remove this line otherwise the crash won't happen which is weird since this is never called
}
void read_response_from_serial()
{  
  delay(2000);
  Serial.print("==-1\r\n"); // crashes here
}
void send_wlan_chip_command(char* command)
{
  Serial.print("Sending command to wifi module: ");
  Serial.print(command);
  read_response_from_serial();
  Serial.print("Command response: ");
}
// this function is never called, since the crash happens before the call, but it can't be removed otherwise the crash won't happen
// also it can't  be altered then, the crash also will not happen.
void send_data_over_network()
{
  char number[3] = "12";
  //char number[3] = "";
  char length_of_payload[20] = "0123456789012345678"; // 20 digits if assuming 64 bit integer is the maximum this code will ever run on
//  char length_of_payload[20] = "";
  char *command;

  command = malloc(26);
  command = "AT+CIPSSEND";
  strcat(command, number);
  strcat(command, ",");
  strcat(command, length_of_payload);
  send_wlan_chip_command(command);
  free(command);
}
</code></pre>

<p><strong>This is the according output:</strong></p>

<blockquote>
  <p>Begin Sending command to wifi module: AT+CIFSR==Begin<br>
  Sending command to wifi module: AT+CIFSR==Begin<br>
  Sending command to wifi module: AT+CIFSR==Begin<br>
  Sending command to wifi module: AT+CIFSR==Begin  </p>
</blockquote>

<p>Which means that the arduino keeps crashing and resetting. This goes on forever.</p>

<p>The weird thing is, if I change the following two lines to: (in the"send_data_over_network" function as in example above)</p>

<pre><code>char number[3] = "1"; // changed from =&gt; char number[3] = "";
char length_of_payload[20] = "123"; // changed from =&gt; char length_of_payload[20] = "0123456789012345678";
</code></pre>

<p><strong>The output now changes to :</strong> </p>

<p><a href="https://i.stack.imgur.com/ktptw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ktptw.png" alt="exact output"></a></p>

<p>I call this behaviour weird since it shouldn't have any influence on the result because this function(send_data_over_network) is never called in the crash example from before.</p>

<p><strong>Troubleshooting options i already tried:</strong></p>

<ul>
<li>Reinstalling Arduino IDE , i tried with mutliple versions 1.8 , 1.6, 1.4. 1.0</li>
<li>Different Arduino Boards (Arduino Uno and Arduino Mega)</li>
<li>Different Laptops (since i thought maybe it's related to power issues of my laptop)</li>
</ul>

<p>Maybe it's something obvious and i just can't see it, but i already spent +16h debugging, so help would be really appreciated.</p>
 31105: <p>This code looks wrong:</p>

<pre><code>  command = malloc(26);
  command = "AT+CIPSSEND";
  strcat(command, number);
  strcat(command, ",");
  strcat(command, length_of_payload);
  send_wlan_chip_command(command);
</code></pre>

<p>First you allocate 26 bytes, then a new string is created, which you strcat to it. This happens in memory that is not allocated (or overwrites other data).</p>

<p>Instead of </p>

<pre><code>  command = "AT+CIPSSEND";
</code></pre>

<p>use</p>

<pre><code>  strcpy(command, "AT+CIPSSEND");
</code></pre>

<p>Also check that 26 bytes is enough, change it to 128 bytes to be sure (check the correct amount you need later).</p>
 28658: <p>You are almost certainly running out of memory and have a stack collision with the heap. Dynamic memory allocation and de-allocation is not a good idea when you have less than 2K RAM to work with. If you use malloc() use it only to allocate buffer space and then reuse the buffers. Put your test code entirely in setup and see what happens. Also check the amount of RAM allocated at compile time it may be more than you think.</p>

<pre><code>char *buf1;
char *buf2;

void setup() {
   buf1 = (char *) malloc(10);
   buf2 = (char *) malloc(10);
   .
   .
   // test code here
}
</code></pre>
