Android Image.getSize throws Pool hard cap violation

See original GitHub issue

Description

Call Image.getSize with several images (less than 10) throws error

[Error: Pool hard cap violation? Hard cap = 150994944 Used size = 108316036 Free size = 0 Request size = 48771072]

Related to https://github.com/facebook/react-native/issues/10170 https://github.com/facebook/react-native/issues/10569 https://github.com/facebook/react-native/issues/11326

React Native version:

System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
    Memory: 29.09 MB / 8.00 GB
    Shell: 5.0.16 - /usr/local/bin/bash
  Binaries:
    Node: 10.15.1 - /var/folders/cd/p2ngbvv541q7d31dzv1rhfjc0000gn/T/yarn--1587133738606-0.8272158970505921/node
    Yarn: 1.22.4 - /var/folders/cd/p2ngbvv541q7d31dzv1rhfjc0000gn/T/yarn--1587133738606-0.8272158970505921/yarn
    npm: 6.12.0 - ~/.nvm/versions/node/v10.15.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

    Image.getSize(
      uri,
      (width, height) => {},
      (err) => console.log(err)
    );

Expected Results

Returns image width and height without error.

Snack, code example, screenshot, or link to a repository:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

13reactions
diegovfedercommented, Nov 18, 2020

Actually I found a solution. As I was getting this problem only for Android I needed to add this to “android/app/src/main/AndroidManifest.xml”

<application android:largeHeap=“true”

1reaction
karatekid430commented, Aug 11, 2021

@marcaaron using removeClippedSubviews not only solved our images not loading on Android, but also resulted in a vast performance improvement. Life saver. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pool hard cap violation? Android images in React native
I have an Image component inside a modal in react native .64, and it works perfectly on iOS, but with Android I get...
Read more >
fear48/react-native - Gitter
Hey All, im new to react-native and i have an issue with Image source. i have a json object that contains a local...
Read more >
[RN Error]Android Image.getSize throws Pool hard cap violation
[RN Error]Android Image.getSize throws Pool hard cap violation ... android 에서만 이미지가 로드 되지 못하는 현상 발생 했다. 원인은 해당 스크린 전 ...
Read more >
SoundPool | Android Developers
Limiting the maximum number of streams helps to cap CPU loading and reducing the likelihood that audio mixing will impact visuals or UI...
Read more >
分享学习知识: 认真的雪
getSize ()加载失败、报错、闪退,或Error: Pool hard cap violation? ... React Native 网络图片必须设置大小才能显示,可以通过Image.ge 阅读更多…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found