When using Eclipse for Android development, it can consume a lot of memory. If you’re working with multiple library projects with varying levels of target APIs and/or opening layout editors for different Android versions, sooner or later the java VM running the Eclipse IDE will run out of memory. This results in crashes, or even worse: cryptic, seemingly unrelated error messages and compilation errors.
To increase the memory available for the IDE, open
eclipse.ini in your Eclipse folder and look for these lines:
... -Xms40m -Xmx512m ...
Change them to the following:
... -Xms512m -Xmx1024m ...
This should be sufficient for most development work, at least I haven’t encountered any issues since I’ve made these changes.