Android Question How to create an app to occupy a large part of the device memory

it can be done easier.

try something like this

Code: Copy
For x=0 To 9999
    Dim y(65535) As Byte
Next

or put the dim in a timer
 
Upvote 0
Given that I'm waiting the O.S. kills my app which is in background, for a test, I would develop an app which can occupy a large part (or all) of the device memory :).

Any idea?

A loop that adds ImageViews to an activity (in the Activity_Create) containing big images?
I fear that this kind of app will fill only the memory dedicated to its process. I need to know if I can reserve a lot of memory to an application
 
Upvote 0
I guess it depends if you stick to java or use these C based object files. they seems to be able to deal with more memory.

It might kill your background app to free resources for the forground one.
 
Upvote 0
To have reallistic process killing, Create more than one app to run in the background and load a large bitmap in memory.

Also in the apps, add this line to the manifest:

Code: Copy
SetApplicationAttribute(android:largeHeap, "true")
 
Upvote 0
To have reallistic process killing, Create more than one app to run in the background and load a large bitmap in memory.

Also in the apps, add this line to the manifest:

Code: Copy
SetApplicationAttribute(android:largeHeap, "true")
The largeheap parameter won't consume all the memory (on some devices, it's far from being the case) and you're not sure that you will kill the instance of your test app this way (Android may decide to kill the other instances of your apps created to fill the memory instead). And creating many apps to fill the memory requires to launch them, one by one.
The only convenient and efficient method is in post #12. It simulates what happens with a big game.
 
Upvote 0
Back
Top