Dynamically change which app a ruby process runs

Is there anyway to tell a running ruby process to dynamically switch to
a different rails app? That is, without killing the process and
starting up a new ruby vm.

Say I have two rails apps:

$ rails test1
$ rails test2
$ cd test1
$ script/server
running…

A ruby vm starts up and serves requests based on all the logic in the
test1 app. Then, without killing the vm, can I switch and make it act
as if script/server was launched from the test2 directory?

The idea is to dynamically do this based on the domain of the request.
So test1.mydomain.com and test2.mydomain.com each run different apps.
But, I don’t need separate vms running for each app. This way I could
have hundreds of apps, all sharing the same vm or same few vms if using
mongrel cluster. Each ruby vm takes at least 20 megs of memory, so it’s
not practical to have one for each app if you have hundreds of apps.
Thanks!