LuckSiege / LuckSiege/PictureSelector

OOM异常

Open
#2,884 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
13.6k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## Current use version?
#### 当前使用的版本是多少?

```
3.11.2
```

## Will this problem occur in demo?
#### Demo能否复现这问题?

```
偶现。图片压缩库
```

## Describe the problem or provide an error log?
#### 描述问题或提供错误log?

```
Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 134217744 byte allocation with 92842600 free bytes and 88MB until OOM, target footprint 268435456, growth limit 268435456
java.util.Arrays.copyOf (Arrays.java:3670)

java.io.ByteArrayOutputStream.write (ByteArrayOutputStream.java:156)
top.zibin.luban.Checker.toByteArray (Checker.java:201)
top.zibin.luban.Checker.isJPG (Checker.java:28)
top.zibin.luban.Engine.compress (Engine.java:76)
top.zibin.luban.Luban.compressReal (Luban.java:213)
top.zibin.luban.Luban.compress (Luban.java:194)
top.zibin.luban.Luban.access$1000 (Luban.java:23)
top.zibin.luban.Luban$1.run (Luban.java:146)
android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:305)

java.lang.Thread.run (Thread.java:1012)
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported stack trace and inspect Checker.java, especially toByteArray and isJPG, then follow the calls through Engine.java and Luban.java. Try to reproduce the intermittent failure with the image-compression path described in the issue. Done means the reported OutOfMemoryError no longer occurs for that case and the behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.