JDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go WrongPROIDEA
It’s late 2016, so you probably have been using Java 8 goodies for a while: lambdas, Stream, Optional, new date API ‒ stuff which makes Java development much more pleasant. But the question is: do you know these tools well? I bet you said yes, because writing sweet Java 8 code is piece of cake ‒ you’re using efficient, parallel streams and many lambdas, so what could possibly go wrong? Let me put this straight: most probably you’re doing something wrong. In this talk I won’t actually try to prove that you don’t know what you’re doing, on the contrary ‒ I’ll try to help you be a better programmer by pointing out few mistakes you can make when writing Java 8 code (I know that because I made them all). I’ll also discuss couple common misconceptions regarding Stream and Optional and mention missing language features (also if there is a chance to see them in Java 9 or what library should you use instead). Last but not least, I’ll present you a number of lesser-known gems I found in deepest corners of JDK API, which, I hope, will make your life as a software developer a little bit easier.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go WrongPROIDEA
It’s late 2016, so you probably have been using Java 8 goodies for a while: lambdas, Stream, Optional, new date API ‒ stuff which makes Java development much more pleasant. But the question is: do you know these tools well? I bet you said yes, because writing sweet Java 8 code is piece of cake ‒ you’re using efficient, parallel streams and many lambdas, so what could possibly go wrong? Let me put this straight: most probably you’re doing something wrong. In this talk I won’t actually try to prove that you don’t know what you’re doing, on the contrary ‒ I’ll try to help you be a better programmer by pointing out few mistakes you can make when writing Java 8 code (I know that because I made them all). I’ll also discuss couple common misconceptions regarding Stream and Optional and mention missing language features (also if there is a chance to see them in Java 9 or what library should you use instead). Last but not least, I’ll present you a number of lesser-known gems I found in deepest corners of JDK API, which, I hope, will make your life as a software developer a little bit easier.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
This session is all about - the mechanism provided by Java Virtual Machine to reclaim heap space from objects which are eligible for Garbage collection.
Understanding Java Garbage Collection - And What You Can Do About ItAzul Systems Inc.
Garbage collection is an integral but often misunderstood part of application behavior on Java platforms. As such, it is important for Java developers to understand how collector mechanisms work. This presentation reviews and classifies the major garbage collectors available in JVMs today. Following an overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors. It also discusses trade-offs in balancing requirements for responsiveness, throughput, space, and available memory and covers some pitfalls, common misconceptions, and garbage collection behavior myths.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
The .NET Garbage Collector (GC) helps provide our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Can we do without allocations? Are strings evil? It still matters to understand when and where memory is allocated.
In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
Building Sexy Real-Time Analytics Systems - Erlang Factory NYC / Toronto 2013lpgauth
In the world of Real-time bidding (RTB), it is crucial to get performance metrics as soon as possible. This is why AdGear build their own real-time analytics system.
In this talk, Louis-Philippe will share with you what he has learnt building this system and he will introduce Swirl, AdGear's lightweight distributed stream processor. He will also give some clues on how to build a subset of SQL to power your distributed jobs.
Talk objectives:
- Introduce Swirl, a lightweight distributed stream processor
- Implement a subset of SQL (lexer + parser + boolean logic)
- Demo real-time graphing web interface powered by Swirl, Cowboy, Bullet and D3.js
Performance Monitoring for Docker Environments - Docker Amsterdam June MeetupStijn Polfliet
Performance monitoring for Docker
Challenges around Docker monitoring - Anomaly detection - CoScale demo
For more info about how to use CoScale Docker monitoring, some reading material here: http://www.coscale.com/blog/how-to-monitor-docker-containers-with-coscale and http://www.coscale.com/blog/how-to-monitor-your-kubernetes-cluster
A summary of CoScale Docker performance monitoring can be found here: http://www.coscale.com/docker-monitoring
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementEmery Berger
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
A presentation given to Overstock.com IT at annual conference. Twitter @TECHknO 2015. Goal of the presentation is to provide a good introduction to the reactive programming model with RxJava.
Debugging Complex Systems - Erlang Factory SF 2015lpgauth
Debugging complex systems can be difficult. Luckily, the Erlang ecosystem is full of tools to help you out. With the right mindset and the right tools, debugging complex Erlang systems can be easy. In this talk, I'll share the debugging methodology I've developed over the years.
The Popper Experimentation Protocol and CLI toolIvo Jimenez
Popper is a convention for conducting scientific explorations and writing academic articles following a DevOps approach. Popper allows researchers to automate the re-execution and validation of experimentation (computational and analysis) pipelines. This talk gives an overview and examples.
This session is all about - the mechanism provided by Java Virtual Machine to reclaim heap space from objects which are eligible for Garbage collection.
Understanding Java Garbage Collection - And What You Can Do About ItAzul Systems Inc.
Garbage collection is an integral but often misunderstood part of application behavior on Java platforms. As such, it is important for Java developers to understand how collector mechanisms work. This presentation reviews and classifies the major garbage collectors available in JVMs today. Following an overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors. It also discusses trade-offs in balancing requirements for responsiveness, throughput, space, and available memory and covers some pitfalls, common misconceptions, and garbage collection behavior myths.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down m...Maarten Balliauw
The .NET Garbage Collector (GC) helps provide our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Can we do without allocations? Are strings evil? It still matters to understand when and where memory is allocated.
In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
Building Sexy Real-Time Analytics Systems - Erlang Factory NYC / Toronto 2013lpgauth
In the world of Real-time bidding (RTB), it is crucial to get performance metrics as soon as possible. This is why AdGear build their own real-time analytics system.
In this talk, Louis-Philippe will share with you what he has learnt building this system and he will introduce Swirl, AdGear's lightweight distributed stream processor. He will also give some clues on how to build a subset of SQL to power your distributed jobs.
Talk objectives:
- Introduce Swirl, a lightweight distributed stream processor
- Implement a subset of SQL (lexer + parser + boolean logic)
- Demo real-time graphing web interface powered by Swirl, Cowboy, Bullet and D3.js
Performance Monitoring for Docker Environments - Docker Amsterdam June MeetupStijn Polfliet
Performance monitoring for Docker
Challenges around Docker monitoring - Anomaly detection - CoScale demo
For more info about how to use CoScale Docker monitoring, some reading material here: http://www.coscale.com/blog/how-to-monitor-docker-containers-with-coscale and http://www.coscale.com/blog/how-to-monitor-your-kubernetes-cluster
A summary of CoScale Docker performance monitoring can be found here: http://www.coscale.com/docker-monitoring
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementEmery Berger
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
A presentation given to Overstock.com IT at annual conference. Twitter @TECHknO 2015. Goal of the presentation is to provide a good introduction to the reactive programming model with RxJava.
Debugging Complex Systems - Erlang Factory SF 2015lpgauth
Debugging complex systems can be difficult. Luckily, the Erlang ecosystem is full of tools to help you out. With the right mindset and the right tools, debugging complex Erlang systems can be easy. In this talk, I'll share the debugging methodology I've developed over the years.
The Popper Experimentation Protocol and CLI toolIvo Jimenez
Popper is a convention for conducting scientific explorations and writing academic articles following a DevOps approach. Popper allows researchers to automate the re-execution and validation of experimentation (computational and analysis) pipelines. This talk gives an overview and examples.
This presentation aims to demonstrate the importance of certain practices in Android Application Development to avoid annoying memory leaks which lead to fatal crash .
Mobile OS controls smartphone, tablet, PDA, or other mobile device. Modern mobile operating systems combine the features of a personal computer operating system with touchscreen, cellular, Bluetooth, WiFi, GPS mobile navigation, camera, video camera, speech recognition, voice recorder, music player, Near field communication, personal digital assistant (PDA), and other features.
Slides for my talk at the Square Presents - Streamlining Android Apps: https://corner.squareup.com/2015/06/streamlining-android-apps.html
In just a few few weeks, we reduced by 94% the OutOfMemoryError crashes in the Square Register Android app. We built squ.re/leakcanary to automatically detect memory leaks and make it very easy to fix them. This talk will cover the principles as well as the underlying implementation details. We'll dig into a few interesting examples and lessons learned.
Automatically Tolerating And Correcting Memory ErrorsEmery Berger
Applications written in unsafe languages like C and C++ are vulnerable to memory errors such as buffer overflows, dangling pointers, and reads of uninitialized data. These errors, which lead to program crashes, security vulnerabilities, and unpredictable behavior, are both difficult to avoid and costly to repair.
This talk presents two systems that automatically harden unaltered C and C++ programs against heap-based memory errors. The first, DieHard, uses randomization and replication to make programs probabilistically resistant to a wide range of memory errors. Instead of crashing or running amok, DieHard lets programs run correctly in the face of memory errors with high probability. DieHard trades a modest increase in memory consumption (and optionally, the extra processing power of multicore CPUs) for dramatically increased reliability.
While DieHard tolerates errors, our second system, Exterminator, automatically isolates and corrects them. Exterminator exploits randomization to pinpoint errors with high precision. From this information, Exterminator generates patches that fix these errors in current and subsequent executions. In addition, Exterminator enables collaborative bug correction by merging patches generated by multiple users.
DieHard: Probabilistic Memory Safety for Unsafe LanguagesEmery Berger
DieHard uses randomization and replication to transparently make C and C++ programs tolerate a wide range of errors, including buffer overflows and dangling pointers. Instead of crashing or running amok, DieHard lets programs continue to run correctly in the face of memory errors with high probability. Using DieHard also makes programs highly resistant to heap-based hacker attacks. Downloadable at www.diehard-software.org.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Maarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
“Show Me the Garbage!”, Understanding Garbage CollectionHaim Yadid
“Just leave the garbage outside and we will take care of it for you”. This is the panacea promised by garbage collection mechanisms built into most software stacks available today. So, we don’t need to think about it anymore, right? Wrong! When misused, garbage collectors can fail miserably. When this happens they slow down your application and lead to unacceptable pauses. In this talk we will go over different garbage collectors approaches in different software runtimes and what are the conditions which enable them to function well.
Presented on Reversim summit 2019
https://summit2019.reversim.com/session/5c754052d0e22f001706cbd8
Exploring Java Heap Dumps (Oracle Code One 2018)Ryan Cuprak
Memory leaks are not always simple or easy to find. Heap dumps from production systems are often gigantic (4+ gigs) with millions of objects in memory. Simple spot checking with traditional tools is woefully inadequate in these situations, especially with real data. Leaks can be entire object graphs with enormous amounts of noise. This session will show you how to build custom tools using the Apache NetBeans Profiler/Heapwalker APIs. Using these APIs, you can read and analyze Java heaps programmatically to ask really hard questions. This gives you the power to analyze complex object graphs with tens of thousands of objects in seconds.
Valgrind is a GPL'd system for debugging and profiling Linux programs. With Valgrind's tool suite you can automatically detect many memory management and threading bugs, avoiding hours of frustrating bug-hunting, making your programs more stable. You can also perform detailed profiling to help speed up your programs.
How to Perform Memory Leak Test Using ValgrindRapidValue
Recently we came across a performance issue in our network test device wherein the device performance was comparatively getting slower when a particular module of the application was being load tested. We also observed unexpected application behaviors and application termination as well and while debugging the code, it was identified that the root cause was a memory leak. Fixing the memory leak resulted in better performance. A memory leak is the loss of available memory when a program fails to return memory that it has obtained for temporary use. For a program that is frequently opened or for the one that runs continuously, even a very small memory leak can eventually cause the program to terminate. A memory leak is the result of a programming bug and hence it is very important to test it during the development phase. Therefore it is important to start considering memory leak testing as part of QA testing to avoid any such memory-related issues, which could cause production disruptions. This blog post sheds light on performing a memory leak test using Valgrind and the other various options that are available in the market.
Similar to Identifying memory leaks in Android applications (20)
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
4. Java/Android Garbage Collection
• All objects created with new are stored on the heap
• GC periodically disposes of objects that are eligible for
garbage collection
• Android GC uses a mark-and-sweep algorithm
5. What is “eligible for garbage collection”?
• Not reachable from any live threads or any static
references
− There are no references to the object!
• Cyclic references are not counted.
6. What is “eligible for garbage collection”?
Simple Example:
Integer volume = new Integer(100);
Integer
System.out.println(volume); 100
volume = null;
Volume
7. What is “eligible for garbage collection”?
Simple Example:
Integer volume = new Integer(100);
Integer
System.out.println(volume); 100
volume = null;
Volume
8. What is “eligible for garbage collection”?
Simple Example:
Integer volume = new Integer(100);
Integer
System.out.println(volume); 100
volume = null; null
Volume
9. What is “eligible for garbage collection”?
Simple Example:
Integer volume = new Integer(100); Integer
Garbage
System.out.println(volume); collected!
volume = null; null
Volume
10. What is “eligible for garbage collection”?
• Lists, Maps, and Sets are prime suspects for memory
leaks, because they can accidentally retain references to
unused objects!
Integer volume = new Integer(100);
Integer
System.out.println(volume); 100
volumeList.add(volume); null
volume = null; Volume volumeList
11. Haiku Break #1
Memory leak, crash.
Lingering reference, why!?
You make GC cry.
12. Detecting a memory leak
Clue #1: Your application crashes with an
java.lang.OutOfMemoryError after running for a long time.
Clue #2: You see frequent GC_ lines in logcat before the
crash.
D/dalvikvm( 1325): GC_CONCURRENT freed 1971K,
18% free 12382K/14983K, paused 3ms+7ms
Heap statistics
Reason for garbage
collection:
GC_CONCURRENT
GC_FOR_MALLOC
GC_EXTERNAL_ALLOC
GC_HPROF_DUMP_HEAP
GC_EXPLICIT
13. Identifying the source of the leak
• Step #1
Use DDMS (Dalvik Debug Monitor Server) to dump heap
snapshots (an HPROF file)
− android-sdkstoolsddms.bat
14. Identifying the source of the leak
• Step #2
Use the Android SDK’s “hprof-conv” tool to convert the
Android-specific HPROF file into a generic HPROF file
that can be analyzed by Eclipse Memory Analyzer
15. Identifying the source of the leak
• Step #3
Open the converted HPROF using Eclipse Memory
Analyzer
16. Identifying the source of the leak
• Step #4
Analyze the results using the “Histogram” view
17. Identifying the source of the leak
• Step #4
Analyze the results using the “Histogram” view
• Identifies types of objects allocated!
• Doesn’t know whether they will eventually be freed!
• We must compare two HPROF snapshots to identify
which objects are responsible for a leak.
18. Identifying the source of the leak
• Step #5
Exercise your app in a way that tends to cause it to
exhibit the memory leak, and then use DDMS to dump
another heap snapshot
• Step #6
Use “hprof-conv” to convert the HPROF file
19. Identifying the source of the leak
• Step #7
Open both HPROF files in Eclipse Memory Analyzer and
compare their histograms
20. Identifying the source of the leak
• Step #7
Open both HPROF files in Eclipse Memory Analyzer and
compare their histograms
− Compare the number of instances and sizes of each type of object
between the two snapshots.
− A sustained increase in the number of objects may indicate a leak!
21. Identifying the source of the leak
• Step #7
Open both HPROF files in Eclipse Memory Analyzer and
compare their histograms
− Compare the number of instances and sizes of each type of object
between the two snapshots.
− An unexplained increase in the number of objects may indicate a
leak!
22. Identifying the source of the leak
• Step #7
Shallow heap: the size of the objects themselves.
Retained heap: the amount that would be freed if we freed
these objects (greater than shallow heap because
referenced objects may also be freed).
23. Haiku Break #2
Unfreed memory,
Delta of two HPROF dumps
Who references thou?
24. Fixing the leak
• The leak must be the result of unused objects still having
references to them so, you can do one of:
− Stop creating the objects
− Stop maintaining references to the objects
− Use weak references (see WeakHashMap) so that those
references are invalidated if they are the only ones to the object.
− Make sure to close() open streams and connections
25. More Information
• Google I/O 2011: Memory management for Android
Apps https://www.youtube.com/watch?v=_
CruQY55HOk&feature=relmfu