LoginSignup
42
37

More than 5 years have passed since last update.

Androidで大きいヒープを確保する

Last updated at Posted at 2014-06-26

Androidでは大きいヒープ領域を確保するための手段が提供されています。
AndroidManifext.xmlのapplicationタグにandroid:largeHeap="true"を記載するだけです。
APIlevel11から利用出来ます。

<application
     android:largeHeap="true" >
</appplication>

この設定をしておくとヒープが足りなくなった時に、新たに大きなヒープを確保します。
最初から大きなヒープを確保するわけではありません。
なお、確保されるヒープの大きさは端末によって異なり、ヒープが増えない端末もあります。

android:largeHeap(API Guides)
API Guidesにも書かれていますが、どうしてもOutOfMemotyErrorが解決出来ない時にのみ設定して下さい。
基本は、設定しなくてもErrorが発生しないようメモリの使用量を抑えるべきです。

42
37
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
42
37