What is Dominator Object? In what circumstances does this thing
happen?. Remember I'm a programmer and I do code. But how the heck
this thing happen? Easy there folks. Lets go through this from the
very bottom of it.
As usual, we start with our lovely but deadly controller. It control our code.
While at logic level, we have our service class. It does the logic and
control data parsing inside the logics. At data level, we have our
models. We may also have the ORM as part of our model. View? Included.
Jsp for view, enough.
But hey, enough with the chat. Now, let's see, when did Dominator
objects happened and what is the effect of having Dominator object.
Not so long time ago, I declare of ORM inside my MainModel (assuming
that MainModel is the model that I used as model in our case). My
program runs. The logical output was true, and the page went well.
|Dao/VO declared in model. Easy to call but remain in memory untill full GC is performed.|
what's wrong with above method? While development and testing, my
bosses found out Memory Issue. Sometime, small Instance that hold
approximate 10 to 20 application will easily do full GC in every hour
basis. It shows serious memory problem. When I declare another class
in a class (Dominator Objects?), though I've nulled the value when not
in use, sometime, they do stay in memory and cleared once Full GC
How to overcome this kind of problem? If the problem started because
of stacked class inside other class, one quick simple solution was to
clear that stacked class. Just carry the value youu need and leave
behind everything as history. This way, I believe GC will happen
faster. Well, theoritically I guess LOL.
|Dao/VO called in service only when program call specific function.|
So now we see, how Dominator Object effect the application memory and
how to overcome this problem. Any question? As usual, you are welcome
to raise question + comments in comment section. Your feedback will
PS: next post: How to programatically done this?