Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

java - largeHeap=true manifest tag not working?

I′m developing a very memory-consuming app and want to use the largeHeap-Tag, which should give the application a bit more memory. Whatever I set this tag in AndroidManifest.xml to, it makes no difference to the actual memory I′ve been given. I′m reading out my max memory like this:

Log.v("Utils","Max Mem in MB:"+(Runtime.getRuntime().maxMemory()/1024/1024));

My manifest looks quite like this:

<application android:label="@string/app_name" android:hardwareAccelerated="true" android:largeHeap="true" android:debuggable="true">

    <activity android:name=".EntryActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

I′m running 3.1 in the emulator, output of my logging above is always 48MB. Can somebody help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use ActivityManager.getMemoryClass() and ActivityManager.getLargeMemoryClass() to verify the approximated values assigned to your app.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...