Fix memory leak
Initialize zval properly
Preallocate 10 memory frames
Merge pull request #1987 from sjinks/memory-opt

Preallocate global memory frames in advance