views:

110

answers:

2

Hi,

I would like to know if for example, I have about 80 domains on my projects, does it means that the 80 domains will be loaded into memory when I run the project or it will be loaded when I need that domain ...

It seems if I have many domains in one project, I have to disable auto compile and increase the perm gen space.

is there any solutions to load just when I need to acces those domain ? not all domain will be used ... sometimes it just small domain that almost never touched by users incase something happens (ie special cases)

I'm using grails 1.1.1 at the moment and have to disable the auto compile for domain or else it will stuck and depleted memory / memory gen space

A: 

Do you run into this problem when running in development mode? If so you could always try changing your development mode data source from an in memory HSQLDB database to a file based HSQLDB database. You can find the file you need to edit in grails-app/conf/DataSource.groovy

Jared
i am using mysql and i did run in development mode.
nightingale2k1
+2  A: 

Grails is backed by Hibernate and Hibernate does need to load every domain class in the configuration on startup, so there isn't away to only load parts of the domain.

Increasing PermGen is a pretty a normal thing to do, especially in development, as the default is only 64mb and class files don't get readily unloaded when grails recompiles stuff and restarts the application.

Have you observed similar memory usage when running from a war file?

Gareth Davis
not yet. i have increased my perm gen space to 300MB and disable auto compile so when I add something/change on domain I have to restart grails. btw why Hibernate need to load everything at the begining ?is java also load all the class while they start an application ?
nightingale2k1
It's hibernate it has to load all the domain classes so that it can verify the configuration and pre generate any proxy's that it may need
Gareth Davis