linkedin Mobile Applications Archives - pCloudy

Memory Leaks & Memory Consumption by Mobile Applications

Anshuman Chatterjee
By Anshuman Chatterjee
June 28, 2017
5 min Read
Share This Article
Memory Leaks & Memory Consumption by Mobile Applications

Uncover Memory Leaks by Mobile Apps

Mobile apps can often crash for many reasons. Nothing is as excruciating as memory leaks. It starts with your app crashing often, or becoming slow or maybe making your entire phone slow down, taking longer time to load activities. Memory leaks are notoriously hard to detect, and thus can easily surprise you. Have we ever thought why most of the users uninstall the application after some use?

Which is why it is critical for Developers to understand the memory consumption by any mobile application. How do you detect memory leaks during Mobile Application Testing? And if so, how can you prevent them from hogging mobile resource consumption?

A little knack for Mobile Application Testing always comes handy.

mobile application testing
Figure 1: Image Credit- GadgetHacks

Want to test your Mobile App?

Join pCloudy Platform!

Memory is critical to device

Memory is one of the key resources of the mobile device.And memory leaks in Android is an important thing to be kept in mind. Java is a garbage collecting language, which removes the need for developers to dig deep to manage allocated memory. This reduces the chances of any segmentation fault crashing an app or any unfreed memory allocation from eating up space of the heap area, thus creating a safer code.

However, a garbage collector is never an insurance against memory leaks. There are other ways by which memory can be leaked within Java. This means that your android mobile application is still pretty prone to wasting unnecessary memory allocation and crashing with out-of-memory (OOM) errors.

Toptal
Figure 1: Image Credit- Toptal

Why are Memory Leaks Bad?

Cause: Memory leaks occur when some variable of the application still has references to some objects that are unnecessary, no longer in use or used to be with the app anymore, is bloating the allocated memory heap and the Garbage Collector is not being able to release that memory.

Effect: Android devices mostly run on phones with limited memory, so as a result of too many leaks, the app runs out of available memory. This triggers more frequent Garbage Collector events which paralyze the device (Stop-the-world GC events) by almost stopping the rendering of UI and processing of events. This leads to an Out of Memory Exception and translates to the user as the app being unresponsive.

Android App Testing

Testing for Memory Leaks

Memory Leaks are caused by the failure to not be able to de-allocate memory that is no longer in use, which is why they cannot be identified during black box testing. The best phase to find the memory leaks is when developers are developing the application, at a code level.

It’s best to check for memory leaks during unit testing. However, testers can follow these tips:

Release Unused Memory: Memory leaks can be present because of the bad design of the application and thus might consume lot of memory when the application is in use

Test on Multiple devices:The memory consumption by the application should be monitored while doing the system & functional testing. One shouldn’t rely on a single device testing as there are plethora of devices in the market.

Detecting Memory Leaks

There are quite a few techniques and tools devised by developers to pin point memory leaks. Android’s very own Android Studio has a powerful tool to monitor not only memory usage but also for network, GPU and CPU usage as well, called the Android Monitor.

Memory Monitor in this helps track memory usage, find de-allocated objects, identify memory leaks and helps get an overall sense of how your app allocates and frees memory. It’s done in three steps:

1. During and use and debugging of app, track the memory monitor. If the memory usage graph rises for your app and doesn’t fall even if put in background, it’s a memory leak.

2. Using the Allocation tracker, you can check the percentage of memory allocated to different types of variables in your app. This gives you a sense of how much memory is consumed by which object.

3. Create a Java Heap Option to create a heap dump that keeps a snapshot of the memory at any given point of time, thus providing the data consumption data.

Despite Android’s monitor to detect memory leaks, there are a few platforms from developers that help extract memory consumption data without so many steps for faster testing cycles.

pCloudy’s very own platform for example, generates the statistics for Memory consumption while doing the normal functional Mobile Application Testing on real mobile devices.It also generates other vital data such as CPU consumption, battery consumption & data consumption for testers and developers who reiterate several test cycles across multiple physical devices.

mobile application testing
Figure 1: Image Credit- Android Developers Studio

Want to test your Mobile App?

Join pCloudy Platform!

Anshuman Chatterjee
Anshuman Chatterjee

Anshuman Chatterjee is a technical consultant at pCloudy who enjoys traveling and singing. When he is not working, you would find him reading Sidney Sheldon and Agatha Christie.

Related Articles

April 19, 2020
What’s New In pCloudy 5.6?

pCloudy is committed to delivering the best solutions in mobile app testing and therefore we come up with product updates at regular intervals. This time we are thrilled to announce the release of pCloudy 5.6 with exciting new features to…

Learn More Arrow

March 17, 2020
Ensure Continuous Productivity By Leveraging Remote Devices For Mobile App Testing

Remote working is going to be a new normal and remote access tools and platforms will play a key role in maintaining productivity. Working from home has many advantages both for enterprises and teams. There are many tools that help…

Learn More Arrow

January 31, 2020
5 Best Python Frameworks For Test Automation In 2020

Testing framework plays a crucial role in the success of any automated testing process. Choosing the right test automation framework is important as it will maximize the test coverage and improve test efficiency which means a better return on investment.…

Learn More Arrow

Type of Mobile Applications – A Snapshot

Avinash
By Avinash
May 29, 2015
1 min Read
Share This Article
Type of Mobile Applications – A Snapshot

MOBILE APP TYPES


There are three popular type of Mobile Applications : Native, Hybrid and Mobile Web.
Each type of App has certain characteristics which are different from other types.
In this article, we have given a snapshot of each type of App, it’s advantages and disadvantages and comparison between each type.

INFO_Comparison-of-Mobile-App-Types1sadfa

Avinash
Avinash

Avinash Tiwari is a thought leader, a recognized keynote speaker, and the co-founder of pCloudy.com. He has 15+ experience in Product development and Testing. He brings with him a passion for emerging technology and quick adoption, both of which have solidified his reputation as a leader in the mobile app testing field.

Related Articles

June 28, 2017
Memory Leaks & Memory Consumption by Mobile Applications

Uncover Memory Leaks by Mobile Apps   Mobile apps can often crash for many reasons. Nothing is as excruciating as memory leaks. It starts with your app crashing often, or becoming slow or maybe making your entire phone slow down,…

Learn More Arrow

May 24, 2015
Internet of Things – Connecting Physical World to the Internet?

Internet of Things   Have you heard the term “Internet of Things” or “IOT” lately? The answer might be yes for most of you. Have you wondered what’s the buzz all about? What do we call “things” here? And, what…

Learn More Arrow

Internet of Things – Connecting Physical World to the Internet?

nilesh
By nilesh
May 24, 2015
2 min Read
Share This Article
Internet of Things – Connecting Physical World to the Internet?

Internet of Things

Have you heard the term “Internet of Things” or “IOT” lately? The answer might be yes for most of you. Have you wondered what’s the buzz all about? What do we call “things” here? And, what is it to do with Internet? We will try to understand the phenomenon in this article.

Firstly we need to understand what are “things” here?

We are talking about physical things. It could be anything objects, appliances, vehicles, buildings, Animals, people, anything on planet.

Secondly, these things have to be transformed into smartThing. So, what are SmartThings?

As you can see in the depiction below, physical objects become smart objects when they get associated with sensors and an IP.

iot-1

Lastly, how these smart objects communicate over Internet?

Once physical objects have sensors and an associated IP, these objects get the ability to send and receive data. This data can be transferred using internet and can also be stored on cloud. Moreover, this data can be consumed by various Applications, mostly Mobile Applications.

iot_2

This means Your App on Mobile device can communicate to a physical object like your freeze or your keys or your light switch in your house. It can receive information and send commands to perform actions.

This whole ecosystem is termed as Internet of Things.

So, how does it impact our life? In fact, this can impact our lives beyond our imagination.

In future, Google will not only remain a search engines for web content but you will also be able to perform operations like this.

iot-3

Or

Your fridge will send you an alert on your Mobile phone to bring milk packets as soon as you reach a super market.

iot-4

By now, you would have observed that IOT is about connecting our physical world to Internet. It’s predicted that by 2020 there will be 50 Billion smart Objects. And, every human being will be surrounded by 3000 to 5000 smart Objects.

iot-5

Does it trigger any thought, how are you going to test applications built for Internet of Things? We will soon be discussing that in our upcoming post.

nilesh
nilesh

Nilesh is the vice-president at pCloudy and has around 16 years of experience in Product development and Testing. He has worked primarily in the mobile application testing and mobile device testing domain with companies like Sasken, Motorola, Nokia, and Accenture.

Related Articles

August 4, 2020
UST Global invests in pCloudy

We feel elated to inform you all that UST Global, a digital transformation solutions company, has announced a strategic investment in Smart software testing solutions (SSTS) Inc. The UST Global team sees great potential in our SaaS platforms - pCloudy…

Learn More Arrow

June 28, 2017
Memory Leaks & Memory Consumption by Mobile Applications

Uncover Memory Leaks by Mobile Apps   Mobile apps can often crash for many reasons. Nothing is as excruciating as memory leaks. It starts with your app crashing often, or becoming slow or maybe making your entire phone slow down,…

Learn More Arrow

August 19, 2016
Five key iOS 10 Features Every App Developer Must Know

Five key iOS 10 Features   The upcoming iOS 10 has sparked great interest among app developers owing to it's rich, better-than-ever features. The beta version of iOS 10 SDK includes new APIs and services that will power a whole…

Learn More Arrow

Experience pCloudy Today

Tickmark No Credit Card Required
Tickmark Exceptional Security

Copyright All Rights Reserved © 2020