Code Monkey home page Code Monkey logo

android-multithreading-masterclass's People

Contributors

techyourchance avatar vzukanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-multithreading-masterclass's Issues

thread pool demo get Force Close

public ThreadPoolExecutor getThreadPool() {
if (mThreadPoolExecutor == null) {
mThreadPoolExecutor = new ThreadPoolExecutor(
10,
Integer.MAX_VALUE,
10,
TimeUnit.SECONDS,
new SynchronousQueue<>(),
new ThreadFactory() {
@OverRide
public Thread newThread(Runnable r) {
Log.d("ThreadFactory",
String.format("size %s, active count %s, queue remaining %s",
mThreadPoolExecutor.getPoolSize(),
mThreadPoolExecutor.getActiveCount(),
mThreadPoolExecutor.getQueue().remainingCapacity()
)
);
return new Thread(r);
}
}
);

hi, I still get force close even if with SynchronousQueue :
10-19 12:12:58.868 D 22091 24162 ThreadFactory: size 6544, active count 6543, queue remaining 0
10-19 12:12:58.869 D 22091 24129 ThreadFactory: size 6542, active count 6541, queue remaining 0
10-19 12:12:58.869 W 22091 24129 libc : pthread_create failed: couldnt mprotect R+W 1081344-byte thread mapping region: Out of memory
10-19 12:12:58.869 W 22091 24129 .multithreadin: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" (VmSize 131067384 kB)
10-19 12:12:58.869 W 22091 24162 libc : pthread_create failed: couldnt mprotect R+W 1081344-byte thread mapping region: Out of memory
10-19 12:12:58.869 W 22091 24162 .multithreadin: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" (VmSize 131067384 kB)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: FATAL EXCEPTION: Thread-1529
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: Process: com.techyourchance.multithreading, PID: 22091
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.lang.Thread.nativeCreate(Native Method)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.lang.Thread.start(Thread.java:884)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:975)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1043)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1185)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
10-19 12:12:58.870 E 22091 24129 AndroidRuntime: at java.lang.Thread.run(Thread.java:920)
10-19 12:12:58.870 E 22091 24162 AndroidRuntime: FATAL EXCEPTION: Thread-1561
10-19 12:12:58.870 E 22091 24162 AndroidRuntime: Process: com.techyourchance.multithreading, PID: 22091
10-19 12:12:58.870 E 22091 24162 AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
10-19 12:12:58.870 E 22091 24162 AndroidRuntime: at java.lang.Thread.nativeCreate(Native Method)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.