Hot fix memory management

Fixed some critical memory issues.
Dedicated Allocators for each input gate.