Skip to content

RUM-14330: Optimizations to reduce .so file#3190

Open
kikoveiga wants to merge 2 commits intodevelopfrom
kikoveiga/RUM-14330/reduce-size-ndk-so-file
Open

RUM-14330: Optimizations to reduce .so file#3190
kikoveiga wants to merge 2 commits intodevelopfrom
kikoveiga/RUM-14330/reduce-size-ndk-so-file

Conversation

@kikoveiga
Copy link
Contributor

@kikoveiga kikoveiga commented Feb 19, 2026

What does this PR do?

  • Adds compiler and linker size optimizations to the NDK module's CMake configuration, reducing the .so file size by around 50%.
  • Minor code cleanups (remove unused imports, CLion suggestions)

Motivation

The .so for arm64-v8a was ~860 KB — larger than the SDK's APK footprint (~570 KB) without the ndk.

Below are analysis of this file inside the Sample app release APK done in Android Studio, describing Size on the left and Download Size on the right.

Before (sample app release APK on develop branch):
image

After (with these optimizations):
image

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-14330/reduce-size-ndk-so-file branch 2 times, most recently from ea86e35 to b8c18c3 Compare February 19, 2026 10:44
@kikoveiga kikoveiga self-assigned this Feb 19, 2026
@datadog-official

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.29%. Comparing base (da85551) to head (5c41110).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3190      +/-   ##
===========================================
- Coverage    71.31%   71.29%   -0.02%     
===========================================
  Files          929      929              
  Lines        34442    34442              
  Branches      5813     5813              
===========================================
- Hits         24562    24554       -8     
- Misses        8247     8250       +3     
- Partials      1633     1638       +5     

see 39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-14330/reduce-size-ndk-so-file branch from b8c18c3 to 89a5d6e Compare February 19, 2026 14:46
@kikoveiga kikoveiga force-pushed the kikoveiga/RUM-14330/reduce-size-ndk-so-file branch from 89a5d6e to 9318ad7 Compare February 19, 2026 15:08
@kikoveiga kikoveiga marked this pull request as ready for review February 19, 2026 15:12
@kikoveiga kikoveiga requested a review from a team as a code owner February 19, 2026 15:12
0xnm
0xnm previously approved these changes Feb 19, 2026
Copy link
Member

@0xnm 0xnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If everything works in Release build and NDK crash is captured and sent, then all good 👍

@0xnm
Copy link
Member

0xnm commented Feb 19, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xnm the compiler was optimizing and removing the code of sigsegv and sigill ndk crashes (even before my changes) in release builds, so the buttons on the sample app didn't work. Simplified this and confirmed NDK crashes are being sent to Datadog and working fine.

@kikoveiga kikoveiga requested a review from 0xnm February 19, 2026 16:51
#include <jni.h>
#include <signal.h>

void crash_with_sigsegv_signal() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the need for this change? raise indeed will raise the necessary signal, but the code here is to illustrate the real example leading to the particular signal.

-Werror -Wall -pedantic)

# Size optimizations for non-Debug builds
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing to check for release builds: once NDK crash happens and if Datadog NDK makes a part of the stacktrace, can we still symbolicate such frames after binary shrinking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants