TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Identifying Equivalent Objects to Reduce Memory Consumption
1. Identifying Equivalent Objects to Reduce Memory
Consumption
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel
Universidad de Chile
September, 2013
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
2. Introduction
A little about objects
Creating an object is easy
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
3. Introduction
A little about objects
Creating an object is easy
Object new
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
4. Introduction
My application creates lots of objects. Do I need them all?
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
5. Color Example
Builder>>createNode
ˆ GraphicalElement new color: self defaultColor.
Builder>>defaultColor
"Gray color"
ˆ Color r: 0.5 g: 0.5 b: 0.5
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
6. Identifying Equivalent Objects to Reduce Memory
Consumption
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel
Universidad de Chile
September, 2013
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
7. Object Equivalence
What means Object Equivalence?
Two objects o1 and o2 are said equivalent if all objects pointing to
o1 may instead point to o2 without affecting the program
semantics and execution.
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
8. Object Equivalence
What means Object Equivalence?
Two objects o1 and o2 are said equivalent if all objects pointing to
o1 may instead point to o2 without affecting the program
semantics and execution.
Button
"Exit"
Button
"Apply"
Button
"Copy"
Color
"Gray"
Color
"Gray"
Color
"Gray"
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
9. Object Equivalence
What means Object Equivalence?
Two objects o1 and o2 are said equivalent if all objects pointing to
o1 may instead point to o2 without affecting the program
semantics and execution.
Button
"Exit"
Button
"Apply"
Button
"Copy"
Color
"Gray"
Color
"Gray"
Color
"Gray"
Button
"Exit"
Button
"Apply"
Button
"Copy"
Color
"Gray"
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
10. Object Equivalence
Definition:
Our object equivalence definition says that o1 and o2 are
equivalent if:
o1 and o2 are instances of the same class.
o1 and o2 have identical state.
o1 and o2 do not mutate.
Neither o1 nor o2 uses his identity. (i.e. identityHash)
The creation of o1 nor o2 preforms a side effect.
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
11. Profiling
Memory Profiler
Groups the objects in the execution using the previous
definition.
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
12. Results in Roassal
Unnecessary Objects
Detected that 10.97% of the objects are unnecessary object.
Reduction on the total number of Objects
Allowed us to reduce the total number of objects in 5.1%.
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling
13. Conclusions and Future Work
What we achieved?
Successfully identified redundant objects in the case.
Successfully removed some of the redundant objects.
And now?
More strategies to remove unnecessary objects.
Alejandro Infante, Juan Pablo Sandoval, Alexandre Bergel Memory Profiling