1 / 21

Memory Leaks Presentation

Memory Leaks Presentation. Matthew Welch Thomas Adam Andrew Woods. Introduction. What memory leakage is; How it is handled under: Windows; Linux; MAC OS; Methods that the OS uses to handle memory leaks; Various third-party applications that handle memory leakage;

Télécharger la présentation

Memory Leaks Presentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Memory Leaks Presentation Matthew Welch Thomas Adam Andrew Woods Andrew Woods, Thomas Adam, Matthew Welch

  2. Introduction • What memory leakage is; • How it is handled under: • Windows; • Linux; • MAC OS; • Methods that the OS uses to handle memory leaks; • Various third-party applications that handle memory leakage; • Our own conclusions about how to handle memory leakage; Andrew Woods, Thomas Adam, Matthew Welch

  3. Memory Leakage • Continual allocation of memory to a process; • Memory is never freed; • System becomes unresponsive; Andrew Woods, Thomas Adam, Matthew Welch

  4. Windows • Virtual Memory ; • Process creation allows entire swap file; • Dynamic Link Libraries (dll's) are usually the culprit; Andrew Woods, Thomas Adam, Matthew Welch

  5. Linux • Linux kernel 2.2.X onwards defines Out Of Memory (OOM-killer); • Processes therefore aren't allowed to consume the entire VM; • Self-preservation of the kernel; • Parent/Child hierarchy of processes; • Uninterruptible sleep means the parent process must die; Andrew Woods, Thomas Adam, Matthew Welch

  6. Mac OS • Mac OS 6 had poor memory design features; • Memory allocated via the concept of pointers; • Fragmentation; • MacOS 9 onwards uses techniques from Linux; • Memory leaks mostly confined to applications; Andrew Woods, Thomas Adam, Matthew Welch

  7. Introduction to Memory Recovery • Plugging memory leaks is very similar to doing Garbage Collection. • Not normally done at the OS level, but at the sandbox / virtual machine level. • Time and performance issues. Andrew Woods, Thomas Adam, Matthew Welch

  8. Reference Counting • References additions/deletions are kept track of. • When a block has no references, it may be deleted. • Very easy to get into a situation where memory is not recovered. Andrew Woods, Thomas Adam, Matthew Welch

  9. Mark and Sweep • Two stage process • Mark – System goes from known memory references (program stack, global variables, and CPU registers) • Sweep – Any areas not marked are freed for re-use. Andrew Woods, Thomas Adam, Matthew Welch

  10. Stop and Copy • Similar to Mark and Sweep, Works against fragmentation also • Only instead of Sweep, allocated data is copied to a different area Andrew Woods, Thomas Adam, Matthew Welch

  11. Reference Searching • Search of *all* memory held by the program. • Considers that any data held in memory could be a memory reference. • Quite slow. • Single pass. • Can be done repeatedly for better performance. • May not recover all lost memory – a conservative approach. Andrew Woods, Thomas Adam, Matthew Welch

  12. Smart Pointers and Custom Libraries • Not an algorithm, more of a programming technique. • Available for many languages, especially C, C++ • Normal pointers are ‘operator overloaded’ • Prevent dangling pointers, lost objects. • Can provide automatic memory freeing. • Override the standard memory allocation functions to provide more functionality. Andrew Woods, Thomas Adam, Matthew Welch

  13. Final Note • State of the art Garbage Collection is still improving in terms of: • Execution time • Incremental and interruptible • Approaching suitability for near-real-time systems. Andrew Woods, Thomas Adam, Matthew Welch

  14. Taking a look at three products that are meant to make memory management easier. Andrew Woods, Thomas Adam, Matthew Welch

  15. Why The Need For A Third Party Program • Windows • Poorly programmed applications • Memory leaks • Types of memory management software available • Programming Environment • Application Environment Andrew Woods, Thomas Adam, Matthew Welch

  16. Programs Available • Linux Environment • Dynamic Leak Check • Qps • Memtester • Asmem • Windows Environment • MemDefrag 2 • MemOptimizer • MemMonster • Release RAM • RamCleaner • Clean Ram • SuperRam • Alto Memory Booster • MemTurbo Andrew Woods, Thomas Adam, Matthew Welch

  17. MemMonster Andrew Woods, Thomas Adam, Matthew Welch

  18. Alto Memory Booster Andrew Woods, Thomas Adam, Matthew Welch

  19. MemTurbo Andrew Woods, Thomas Adam, Matthew Welch

  20. Conclusion Andrew Woods, Thomas Adam, Matthew Welch

  21. Towards a Leak Free OS? • First Line: ‘Mark and Sweep’ • Second Line: Restricting the number of memory pages that the process may consume. • Why? • Effectiveness: These methods combined should effectively: • Prevent memory leakage, by recovering memory from leaky processes • For runaway processes, terminating them. • Disadvantages • Timing • Interruptions for GC Andrew Woods, Thomas Adam, Matthew Welch

More Related