Hi Alex,
Scaling doesn't really happen based on memory, but based on latency and number of requests. It's highly tied into your scaling settings (either manual, automatic, or basic), and which exact config you have. You can lookup
this document that contains some information on scaling, or
this one which explains the configuration you can setup (look a bit further down than my link, it includes how to setup the three types of scaling and the options available to you)
But to answer "can we have autoscaling when an instance run out of memory", not on App Engine directly. One thing you definitely can do is to use
ManagedVMs and the beta
autoscaler, which you can set to "target utilization level" based on
CPU utilization.
Since app engine scales a bit differently, there is definitely a way to do it, but it would be a workaround that would be way more involved than simply switching to ManagedVMs, so I wouldn't recommend it, as it would be clunky, might degrade customer experience (by making your whole app a tad slower).
Cheers!