SRAM overflow

well, in fact, with the duration times in the original code, the program runs smooth, so it can.

Well, in fact it can't. If your program is running fine, that is either because you are not dynamically allocating as much memory as you were statically allocating, or because you haven't found where the data is being trashed yet.

It is not because malloc() is somehow able to manufacture memory for you.