Memory Management with Protégé
A common problem that Protégé users encounter when they start working with large ontologies is running out of memory, which results in an error message such as the following:
When this happens, it means you have exceeded the amount of memory that Protégé allocated for the Java Virtual Machine (JVM). There is an easy way to fix this. In your main Protégé directory there should be a file called Protege.I4j.ini. If you open that file in a simple text editor like Notepad and the file hasn't been edited it should look like this:
-Xms200M -Xmx500M -Xss16M
The Xms variable defines the amount of memory that will initially be allocated to Protégé. The Xmx variable defines the maximum amount of memory that Protégé can use. The Xss variable defines the increment that Protégé uses when it needs more memory. I.e., Protégé starts with 200M, then if it needs more will allocate an additional 16M. If it needs even more it will keep allocating 16M until it reaches 500M at which point you get the "Out of Memory" error.
To increase the amount of memory that Protégé can use, just edit this file (it is a good idea to make a copy of the original first), increase the Xmx number, and restart Protégé.
It is common with large ontologies to exceed the 500M limit. The amount of memory a specific ontology will use can't be determined only by its size. In addition to the number of entities, the number and especially complexity of the axioms also plays a role. Also, it is possible to get the "Out of Memory" error when there is an error in the ontology that causes the reasoner to go into an infinite loop. However, often these errors are just caused by the size of your ontology.
On some Windows machines there is a bug that requires you to start Protégé by double clicking on the run.bat file. If that applies to you, rather than edit the init file you should just edit the run.bat file (again make a copy before you do that). You will find that the memory parameters are passed to Protégé in that file.
You can tell how much memory Protégé is using by doing Help>About from the main Protégé menu. The window that pops up will have the version you are using followed by the "Memory settings". It will say something like "Max memory set to 444 MB (via Java -Xmx setting). Currently using 116 MB".