S4 ‐ Memory Analysis - S3-G31-Kotlin-QueueHub/mobile-app-android GitHub Wiki

Login Scenario

On the login screen, a high usage of Object[] is observed, with a total of 95,494 instances, representing significant memory consumption. This is consistent with the application's initialization, as this class is commonly used to manage multiple objects related to user interface setup and credential validation.

The usage of long[] and byte[] is also notable, with 11,116 and 6,428 instances, respectively. This suggests that these structures are associated with processes such as encryption, token handling, or data exchange with Firebase—essential activities in the authentication flow.

Although there are fewer instances of String (713 instances), its memory consumption is significant, around 330 KB. This can be attributed to its use in user inputs, such as email addresses, passwords, or validation and error messages.

Additionally, the presence of primitive structures like int[], char[], and float[] is evident. These classes are likely used for mathematical operations or internal processes required for authentication logic and rendering. For instance, char[] may be related to handling text strings, while int[] and float[] might be used for graphical calculations.

The 5,598 instances of SparseArray reflect an effort to optimize data indexing, especially useful in Android to reduce memory consumption compared to more conventional structures like maps. This suggests that this structure is used to initialize and manage UI components.

Lastly, the use of classes like Cleaner and MetadataRepo$Node, though less prominent in number, indicates processes for efficient resource management and memory cleanup, which is crucial to avoid unnecessary accumulation during initialization.

Overall, memory consumption fluctuations during this process are observed, attributed to multiple backend calls and the initial user data loading. This is typical in authentication operations and interface preparation for user interaction.

Getting a Turn.

From the analysis a noticeable use of Object[] and String can be seen, indicating that a significant number of instances of generic objects and strings have been allocated. This is an expected result due to the interactions and information exchange carried out by the application with the external service. Additionally, it is related to how memory is utilized to store the elements displayed in the UI.

Structures such as ArrayList and LinkedHashMap were also observed, which can be attributed to the mapping used for the list of elements. This is necessary for the application to handle scenarios involving offline functionality. Similarly, the memory consumption observed from instances of SnapshotIdSet is related to the use of Firebase for querying elements, which is expected given the requests made by the application.

On the other hand, memory consumption shows sudden peaks, which can be attributed to screen changes that require data loading, in this case from the Firebase backend. These spikes are typical during data fetching operations and when preparing data for display.

Overall, despite the temporary increase in memory usage, these instances were effectively managed, with a substantial portion allocated in the new space, indicating efficient garbage collection. However, there were isolated instances of memory leaks associated with certain classes that could potentially impact performance if not addressed.

Profile review

This behavior can be attributed to the need to process and display detailed information fetched from Firebase, such as the user’s past interactions and queue history. Moreover, the observed spike in SparseArray and LinkedHashMap$Entry instances suggests that these structures are being employed to manage and organize data dynamically for display in the profile screen.

The memory usage pattern aligns with expected operations when retrieving data from Firestore and processing it to populate the UI.