SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Object graphs
                           swapping
                    m a r i a n o            m a rt i n e z                 p e c k
                                m a r i a n o p e c k @ g m a i l . c o m




                                                    1

Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
The context




                                     2
Wednesday, September 15, 2010
Problem

                       Use more memory than needed.

                       Make OOP languages unsuitable for memory
                       limited devices.

                       Existence of unused but referenced objects.



                                           3
Wednesday, September 15, 2010
The context
     In OOP primary memory is represented by an object graph

                                                Z
                                    X
                                                        Y



                                    A       B       C



                                D       E   F   G               H



                                        I   J   K           L
                                            4
Wednesday, September 15, 2010
Garbage Collector
                    Only collects objects that nobody else points to.

                                                     Z
                                    X
                                                             Y



                                    A       B            C



                                D       E   F       G                H



                                        I   J       K            L
                                            5
Wednesday, September 15, 2010
Garbage Collector
                    Only collects objects that nobody else points to.

                                                     Z
                                    X
                                                             Y



                                    A       B            C



                                D       E   F       G                H



                                        I   J       K            L
                                            5
Wednesday, September 15, 2010
Garbage Collector
                    Only collects objects that nobody else points to.

                                                     Z
                                    X
                                                             Y



                                    A       B            C



                                D       E   F       G                H



                                        I   J       K            L
                                            5
Wednesday, September 15, 2010
Garbage Collector
                    Only collects objects that nobody else points to.

                                                     Z
                                    X
                                                             Y



                                    A       B            C



                                D       E   F       G                H



                                        I   J       K            L
                                            5
Wednesday, September 15, 2010
But...what happens with referenced yet unused objects?


                                                Z
                                    X
                                                        Y



                                    A       B       C



                                D       E   F   G               H



                                        I   J   K           L

                                            6
Wednesday, September 15, 2010
Idea


                       Swap out (not remove) unused objects to
                       disk.

                       Automatically load them back when needed.




                                           7
Wednesday, September 15, 2010
Related work


                       Large object oriented memory (LOOM).

                       Melt - Supporting memory leaks.

                       ImageSegments.




                                          8
Wednesday, September 15, 2010
But...no one solves all the problems




                                         9
Wednesday, September 15, 2010
Main challenges

                       Not to use more memory than the one
                       released by swapping.

                       Low overhead penalty.

                       Group objects in an smart way.



                                           10
Wednesday, September 15, 2010
Key aspects

                       Mark and trace unused/used objects at
                       runtime.

                       The usage of proxies.

                       Group unused objects (subgraphs).



                                           11
Wednesday, September 15, 2010
Why we need to
                                group objects?

                       Because if we replace each object by a proxy,
                       we release little memory.

                       We want to replace a whole group by one or a
                       few proxies.




                                           12
Wednesday, September 15, 2010
Why subgraphs?


                       Group of objects that are used (or not used)
                       together.

                       We need few proxies (for the roots) for
                       several objects.




                                           13
Wednesday, September 15, 2010
Experiments done

                       Modify Smalltalk VM to mark and trace
                       objects usage.

                       Visualize objects and memory usage.

                       Take statistics from different scenarios.



                                             14
Wednesday, September 15, 2010
deployed web
                    application example
                         Used          Unused        Used        Unused
                        Amount of objects            Amount of memory



                                  4%
                                                               15%




                                                       85%
                                96%



                                                15
Wednesday, September 15, 2010
Swapping steps and
                        challenges

                   1.Identify sets of objects and serialize them.
                     Problems: cycles, speed, etc.

                   2.Write the serialized objects into a file.
                     Problems: file format, encoding, speed, etc.

                   3. Load the objects from a file. Problems: class
                     reshape, avoid duplicates, speed, etc.

                                          16
Wednesday, September 15, 2010
Subgraphs
                                Roots            Inner            Shared            External




                                     X                                 Z
                                                                                Y
                                                 Subgraph to process

                                     A                    B                 C
                                    (Root)               (Root)            (Root)




                                D            E            F            G            H



                                             I            J            K            L

                                                          17
Wednesday, September 15, 2010
More
                                                 problems
                                                                              Should shared objects be
         Roots                  Inner            Shared            External
                                                                              included or not?

                                                                              GC moves objects.
              X                                       Z
                                                               Y
                                Subgraph to process                           Pointers update.
               A                         B                 C
             (Root)                     (Root)            (Root)
                                                                              Class changes.

         D             E                 F            G            H          Recreate and reinitialize
                                                                              objects.
                        I                J            K            L
                                                                              Code executed after
                                                                       18     loading.
Wednesday, September 15, 2010
ImageSegment



Wednesday, September 15, 2010
ImageSegment basis
                       Only write/swap roots and inner objects.

                       Shared objects are NOT swapped.

                       Keep an array in memory for the shared
                       objects.

                       Update object pointers to point to a relative
                       address inside the arrays (offset).

                       Roots are replaced by proxies.

                       Uses GC facilities to detect shared objects.
Wednesday, September 15, 2010
Subgraph traverse
    Serialized objects WordArray
                                            Shared objects Array



                                A       B        C


                            D       E   F    G        H


                                    I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’

    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’

    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’

    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’

    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’
                                              D
    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’
                                              D
    Serialized objects WordArray
                                             Shared objects Array



                                 A       B        C


                             D       E   F    G        H


                                     I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’
                                                       D
    Serialized objects WordArray
                                         offset       Shared objects Array



                                 A                B        C


                             D       E            F    G        H


                                     I            J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’       E’
                                                            D
    Serialized objects WordArray
                                              offset       Shared objects Array



                                      A                B        C


                             D            E            F    G        H


                                          I            J    K        L


Wednesday, September 15, 2010
Subgraph traverse
                  offset

      A’       B’       C’       E’
                                                            D
    Serialized objects WordArray
                                              offset       Shared objects Array



                                      A                B        C


                             D            E            F    G        H


                                          I            J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’       E’
                                                   D
    Serialized objects WordArray
                                                  Shared objects Array



                                      A       B        C


                             D            E   F    G        H


                                          I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’       E’
                                                   D
    Serialized objects WordArray
                                                  Shared objects Array



                                      A       B        C


                             D            E   F    G        H


                                          I   J    K        L


Wednesday, September 15, 2010
Subgraph traverse
      A’       B’       C’       E’   I’   H’   L’
                                                          D   F   G       J
    Serialized objects WordArray
                                                         Shared objects Array



                                      A              B        C


                             D             E         F    G           H


                                           I         J    K           L


Wednesday, September 15, 2010
Offset        Memory address


      A’       B’        C’       E’   I’   H’   L’
                                                                 D   F   G       J
      Serialized objects WordArray
                                                               Shared objects Array



                                       A              B              C


                              D              E        F         G            H


                                             I        J         K            L

Wednesday, September 15, 2010
anImageSegment


       A’       B’       C’     E’   I’   H’   L’                     D   F   G   J

Serialized objects WordArray                                         Shared objects Array




                                     A                B                   C


                            D             E           F              G        H


                                          I           J              K        L

Wednesday, September 15, 2010
anImageSegment


       A’       B’       C’     E’   I’   H’   L’                     D    F   G   J

Serialized objects WordArray                                         Shared objects Array




                                     P1              P2                   P3


                            D             E           F              G         H


                                          I           J              K         L

Wednesday, September 15, 2010
anImageSegment


       A’       B’       C’     E’   I’   H’   L’                     D    F   G   J

Serialized objects WordArray                                         Shared objects Array




                                     P1              P2                   P3


                            D             E           F              G         H


                                          I           J              K         L

Wednesday, September 15, 2010
anImageSegment


       A’       B’       C’     E’   I’   H’   L’                     D    F   G   J

Serialized objects WordArray                                         Shared objects Array




                                     P1              P2                   P3


                            D                         F              G


                                                      J              K

Wednesday, September 15, 2010
anImageSegment


                                                                      D   F   G   J
       A’       B’       C’     E’   I’   H’   L’

Serialized objects WordArray                                         Shared objects Array



                Binary file
                                                         P1          P2
                                                                     B                P3
                                                                                      C


                                                            D         F           G


                                                                     J            K


Wednesday, September 15, 2010
anImageSegment


                                                                      D   F   G   J

                                                                     Shared objects Array



                Binary file
    A’       B’       C’        E’   I’   H’   L’        P1          P2
                                                                     B                P3
                                                                                      C


                                                            D         F           G


                                                                     J            K


Wednesday, September 15, 2010
anImageSegment


                            NIL                                       D   F   G   J

                                                                     Shared objects Array



                Binary file
    A’       B’       C’        E’   I’   H’   L’        P1          P2
                                                                     B                P3
                                                                                      C


                                                            D         F           G


                                                                     J            K


Wednesday, September 15, 2010
ImageSegment
                                 conclusions
                        Good speed.

                        Graph traverse is done in VM side.

                        Good use of GC facilities.

                        You have to be aware of shared objects.

                        Bad granularity level.

                        Implicit needed information in object graphs.

Wednesday, September 15, 2010
Thanks!

                                Mariano Martinez Peck
                                marianopeck@gmail.com




Wednesday, September 15, 2010

Weitere ähnliche Inhalte

Mehr von ESUG

The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
ESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
ESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
ESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
ESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
ESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
ESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
ESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
ESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
ESUG
 

Mehr von ESUG (20)

Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 
BioSmalltalk
BioSmalltalkBioSmalltalk
BioSmalltalk
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

Object Graph Swapping

  • 1. Object graphs swapping m a r i a n o m a rt i n e z p e c k m a r i a n o p e c k @ g m a i l . c o m 1 Wednesday, September 15, 2010
  • 2. The context 2 Wednesday, September 15, 2010
  • 3. The context 2 Wednesday, September 15, 2010
  • 4. The context 2 Wednesday, September 15, 2010
  • 5. The context 2 Wednesday, September 15, 2010
  • 6. The context 2 Wednesday, September 15, 2010
  • 7. The context 2 Wednesday, September 15, 2010
  • 8. Problem Use more memory than needed. Make OOP languages unsuitable for memory limited devices. Existence of unused but referenced objects. 3 Wednesday, September 15, 2010
  • 9. The context In OOP primary memory is represented by an object graph Z X Y A B C D E F G H I J K L 4 Wednesday, September 15, 2010
  • 10. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 11. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 12. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 13. Garbage Collector Only collects objects that nobody else points to. Z X Y A B C D E F G H I J K L 5 Wednesday, September 15, 2010
  • 14. But...what happens with referenced yet unused objects? Z X Y A B C D E F G H I J K L 6 Wednesday, September 15, 2010
  • 15. Idea Swap out (not remove) unused objects to disk. Automatically load them back when needed. 7 Wednesday, September 15, 2010
  • 16. Related work Large object oriented memory (LOOM). Melt - Supporting memory leaks. ImageSegments. 8 Wednesday, September 15, 2010
  • 17. But...no one solves all the problems 9 Wednesday, September 15, 2010
  • 18. Main challenges Not to use more memory than the one released by swapping. Low overhead penalty. Group objects in an smart way. 10 Wednesday, September 15, 2010
  • 19. Key aspects Mark and trace unused/used objects at runtime. The usage of proxies. Group unused objects (subgraphs). 11 Wednesday, September 15, 2010
  • 20. Why we need to group objects? Because if we replace each object by a proxy, we release little memory. We want to replace a whole group by one or a few proxies. 12 Wednesday, September 15, 2010
  • 21. Why subgraphs? Group of objects that are used (or not used) together. We need few proxies (for the roots) for several objects. 13 Wednesday, September 15, 2010
  • 22. Experiments done Modify Smalltalk VM to mark and trace objects usage. Visualize objects and memory usage. Take statistics from different scenarios. 14 Wednesday, September 15, 2010
  • 23. deployed web application example Used Unused Used Unused Amount of objects Amount of memory 4% 15% 85% 96% 15 Wednesday, September 15, 2010
  • 24. Swapping steps and challenges 1.Identify sets of objects and serialize them. Problems: cycles, speed, etc. 2.Write the serialized objects into a file. Problems: file format, encoding, speed, etc. 3. Load the objects from a file. Problems: class reshape, avoid duplicates, speed, etc. 16 Wednesday, September 15, 2010
  • 25. Subgraphs Roots Inner Shared External X Z Y Subgraph to process A B C (Root) (Root) (Root) D E F G H I J K L 17 Wednesday, September 15, 2010
  • 26. More problems Should shared objects be Roots Inner Shared External included or not? GC moves objects. X Z Y Subgraph to process Pointers update. A B C (Root) (Root) (Root) Class changes. D E F G H Recreate and reinitialize objects. I J K L Code executed after 18 loading. Wednesday, September 15, 2010
  • 28. ImageSegment basis Only write/swap roots and inner objects. Shared objects are NOT swapped. Keep an array in memory for the shared objects. Update object pointers to point to a relative address inside the arrays (offset). Roots are replaced by proxies. Uses GC facilities to detect shared objects. Wednesday, September 15, 2010
  • 29. Subgraph traverse Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 30. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 31. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 32. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 33. Subgraph traverse A’ B’ C’ Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 34. Subgraph traverse A’ B’ C’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 35. Subgraph traverse A’ B’ C’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 36. Subgraph traverse A’ B’ C’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 37. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 38. Subgraph traverse offset A’ B’ C’ E’ D Serialized objects WordArray offset Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 39. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 40. Subgraph traverse A’ B’ C’ E’ D Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 41. Subgraph traverse A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 42. Offset Memory address A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 43. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array A B C D E F G H I J K L Wednesday, September 15, 2010
  • 44. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D E F G H I J K L Wednesday, September 15, 2010
  • 45. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D E F G H I J K L Wednesday, September 15, 2010
  • 46. anImageSegment A’ B’ C’ E’ I’ H’ L’ D F G J Serialized objects WordArray Shared objects Array P1 P2 P3 D F G J K Wednesday, September 15, 2010
  • 47. anImageSegment D F G J A’ B’ C’ E’ I’ H’ L’ Serialized objects WordArray Shared objects Array Binary file P1 P2 B P3 C D F G J K Wednesday, September 15, 2010
  • 48. anImageSegment D F G J Shared objects Array Binary file A’ B’ C’ E’ I’ H’ L’ P1 P2 B P3 C D F G J K Wednesday, September 15, 2010
  • 49. anImageSegment NIL D F G J Shared objects Array Binary file A’ B’ C’ E’ I’ H’ L’ P1 P2 B P3 C D F G J K Wednesday, September 15, 2010
  • 50. ImageSegment conclusions Good speed. Graph traverse is done in VM side. Good use of GC facilities. You have to be aware of shared objects. Bad granularity level. Implicit needed information in object graphs. Wednesday, September 15, 2010
  • 51. Thanks! Mariano Martinez Peck marianopeck@gmail.com Wednesday, September 15, 2010