Automatic memory allocating stack