Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7716615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:40:45+00:00 2026-06-01T02:40:45+00:00

My UI blocked only in 4.0.* by using clause:Runtime.getRuntime().exec(cat proc/meminfo);. Is there something wrong

  • 0

My UI blocked only in 4.0.* by using clause:”Runtime.getRuntime().exec(“cat proc/meminfo”);”.
Is there something wrong in following code?
Thanks in advance.

Log:

03-27 13:37:18.545: I/MyActivity(19730): ini().429: 1332826638549
03-27 13:37:18.545: I/MyActivity(19730): ini().434: 1332826638549
03-27 13:37:18.865: D/dalvikvm(19611): GC_CONCURRENT freed 389K, 6% free 9733K/10311K, paused 1ms+2ms

Code:

Log.i(getClass().getName(), "ini().434: " + System.currentTimeMillis());

try {
    Process process = Runtime.getRuntime().exec("cat proc/meminfo");//! hang here       
    Log.i(getClass().getName(), "ini().436: " + System.currentTimeMillis());
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));                            
    Log.i(getClass().getName(), "ini().438: " + System.currentTimeMillis());
    String str = bufferedReader.readLine();
    totleMemory = Long.parseLong(str.replaceAll("\\s+", "").replaceAll("[a-zA-Z]", "").replaceAll(":", ""));                            
    Log.i(getClass().getName(), "ini().441: " + System.currentTimeMillis());
    totleMemory *= 1024;
    } catch (Exception e) {
    }   

Log.i(getClass().getName(), "ini().446: " + System.currentTimeMillis());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:40:46+00:00Added an answer on June 1, 2026 at 2:40 am

    I just opened the terminal app on my phone which is running Android 4.0+ and ran your command “cat /proc/meminfo”. I did not allow the app to have “su” or “root” permissions, running as a normal app. The command completed successfully.

    So if I can run it via command line using an application running on the phone, I am sure I can do via ADB shell and most likely in Java.

    I’ve used this code in my applications before:

    try 
        {
        Process process = Runtime.getRuntime().exec("/system/bin/cat /proc/meminfo");
        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        int read;
        char[] buffer = new char[4096];
        StringBuffer output = new StringBuffer();
        while ((read = reader.read(buffer)) > 0) 
        {
            output.append(buffer, 0, read);
        }
        reader.close();
        process.waitFor();
    
        // wrap this in a method and return the string
        return output.toString();
    } catch (Exception e) {
    }
    

    However, when I have tried to run commands what I do not have the correct permissions to run, I have gotten that error “GC_CONCURRENT”.

    Regards,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to crop a photo using client side JavaScript only? When
can cookies be blocked using a page directive instead of doing it programmatic?
I'm following iPhone dev courses from Stanford Open-University, and I've been blocked for 2
Are there any issues using SNAPSHOT isolation to read data consistently for viewing without
I am using @font-face and my page is being blocked from downloading when my
I'm using EclEmma for coverage analysis. My Java code includes a synchronized(MyClass.class) {} block.
I'm using SQLite3 in a Windows application. I have the source code (so-called SQLite
i was blocked by a coldfusion problem, any suggestions are appreciated. now lemme decribe
Google maps in some region can serve traffic information showing the blocked roads and
When I was in China my company's website was blocked for about 24 hours.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.