We have been doing some analysis of an App recently, and found that many of our objects are taking up quite a bit of memory. As an example, one object is taking up 130MB when loaded into Application scope.
On investigation (using the very cool sizeof() method in Lucee) we have found that most of this is being made up by the implicit setter and getter methods. Each accessor is 1.4mb. So each property we add to a model adds 2.8mb to that object when loaded. This seems huge given what an accessor needs to do(?) … (read or write a field to a DB).
Is anyone able to tell me if this is normal? Or is there something wrong here that we need to look into further. Is there some kind of setting or configuration that can reduce the size of these accessors?
That is strange. What is stranger is that if you manually add all of the getters and setters it is still much less than the implicit accessors:
component {
property name="a" default="1";
property name="b" default="1";
property name="c" default="1";
property name="d" default="1";
public function init(){
return this;
}
public function geta(){
return variables.a;
}
public function getb(){
return variables.b;
}
public function getc(){
return variables.c;
}
public function getd(){
return variables.d;
}
public function seta(){
variables.a = arguments.a;
}
public function setb(){
variables.b = arguments.a;
}
public function setc(){
variables.c = arguments.a;
}
public function setd(){
variables.d = arguments.a;
}
}