Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ephemerons: The Strong Path to Finalization by Martin McClure

212 views

Published on

Many applications need to finalize objects before they are garbage-collected. Smalltalk implementations have long provided weak containers as a way to address this need, but the newer ephemeron construct is becoming more widely available. Ephemerons are less well understood. What are ephemeron semantics, exactly? What are the differences (and similarities) between weak containers and ephemerons? What are the advantages and disadvantages? In this talk we'll take a look at these and other questions surrounding finalization, weakness, and ephemerons.

Published in: Technology
  • Login to see the comments

  • Be the first to like this

Ephemerons: The Strong Path to Finalization by Martin McClure

  1. 1. Martin is getting the projector to work with his laptop.
  2. 2. Ephemerons the Strong Path to Finalization Martin McClure
  3. 3. Ephemerons
  4. 4. Ephemerons ...not yet
  5. 5. Finalization
  6. 6. finalize message
  7. 7. Everything is an Object
  8. 8. Everything is an Object
  9. 9. Smalltalk •Objects •?
  10. 10. Messages
  11. 11. ?=
  12. 12. ~=
  13. 13. Smalltalk •Objects •Messages •?
  14. 14. Smalltalk •Objects •Messages •Variables
  15. 15. Smalltalk •Objects •Messages •Variables •?
  16. 16. Smalltalk •Objects •Messages •Variables •Object References
  17. 17. Object Reference •An object reference is a channel for sending a message to an object.
  18. 18. Object Reference •An object reference is a channel for sending a message to an object. •This is the only way to interact with an object.
  19. 19. Smalltalk Syntax • (whitespace) • || • := • ^ • literal objects
  20. 20. Smalltalk Syntax • (whitespace) - Message • || • := • ^ • literal objects
  21. 21. Smalltalk Syntax • (whitespace) - Message • || - Variable • := • ^ • literal objects
  22. 22. Smalltalk Syntax • (whitespace) - Message • || - Variable • := - Reference, Variable • ^ • literal objects
  23. 23. Smalltalk Syntax • (whitespace) - Message • || - Variable • := - Reference, Variable • ^ - Reference • literal objects
  24. 24. Smalltalk Syntax • (whitespace) - Message • || - Variable • := - Reference, Variable • ^ - Reference • literal objects - Reference
  25. 25. GC Contract
  26. 26. Weak Reference
  27. 27. Strong Reference •Keeps the object alive
  28. 28. Strong Reference •Keeps the object alive Weak Reference •Lets the object be GCed
  29. 29. Weak Container
  30. 30. Executor
  31. 31. VA (non)- WeakArray
  32. 32. Ephemeron
  33. 33. Property Dictionary
  34. 34. #mourn
  35. 35. An ephemeron will fire iff all reference paths to its key pass through itself or through other ephemerons which will simultaneously fire.
  36. 36. Ephemeron •Object can be its own executor •Add properties with the same lifetime as instance variables
  37. 37. Ephemerons the Strong Path to Finalization Martin McClure

×