Show a screenshot of your Memory & Multiprocessing preferences dialog box.
Also, in general, we're going to need a lot more information if we're going to be able to help. Please provide answers to the questions listed here: "FAQ: What information should I provide when asking a question on this forum?"
Try reserving more RAM for other applications. That will prevent the operating system from taking it forcefully from After Effects when you switch to another application, which means that there is less chance that your RAM cache will get purged every time that you do so.
I tend to recommend that you reserve about a third of your RAM for other applications to prevent swapping and other problems. See this: