Log in or register to post comments

out of memory when adding textures

April 21, 2013 - 12:56am #1

Hi there, i have a problem here..

i have made 7 model in two datasets, and also i have 7 textures for it, but it shows an error

FATAL EXCEPTION: main

java.lang.OutOfMemoryEror

when i add 6 textures it is okay, but when i add the 7th, my app crashed, what should i do now?

out of memory when adding textures

May 23, 2013 - 9:19pm #10

but can i load textures when rendreing process?

i want load some new texture and replace an old texture..

thanks before :D

out of memory when adding textures

May 23, 2013 - 7:58am #9

As I said on the message below, one thing to try is deleting the textures that are no longer used .

out of memory when adding textures

May 22, 2013 - 7:05pm #8

i have a same problem..out of memory when load more texture..

any solution? what should i do?

out of memory when adding textures

May 12, 2013 - 9:45pm #7

giagi87 wrote:

is there any limit to the number of texture that i can load?

I start ImageTargets activity from another activity, with some devices (not all), eg galaxy note or galaxy SIII, when i close and relaunch ImageTargets activity two or three times, it have OutOfMemoryCrash on loadTexture,is there some way to dealloc memory when close ImageTargets activity?

thanks

giacomo

well, i have a tricky solution for that case.

i never use the backkey to exit my application, try to use an imagebutton or something in screen to exit your application. it works well for me, never crash when i relaunch the application

out of memory when adding textures

May 3, 2013 - 2:42am #6

Hi, the textures are deleted (in native code) in this function:

JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_deinitApplicationNative(
                                                        JNIEnv* env, jobject obj)
{
    LOG("Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_deinitApplicationNative");

    // Release texture resources
    if (textures != 0)
    {    
        for (int i = 0; i < textureCount; ++i)
        {
            delete textures[i];
            textures[i] = NULL;
        }
    
        delete[]textures;
        textures = NULL;
        
        textureCount = 0;
    }
}

This is triggered by the onDestroy() method in the main activity.

Can you check that that function is called when you exit your AR activity ?

out of memory when adding textures

May 3, 2013 - 2:29am #5

is there any limit to the number of texture that i can load?

I start ImageTargets activity from another activity, with some devices (not all), eg galaxy note or galaxy SIII, when i close and relaunch ImageTargets activity two or three times, it have OutOfMemoryCrash on loadTexture,is there some way to dealloc memory when close ImageTargets activity?

thanks

giacomo

out of memory when adding textures

April 25, 2013 - 12:48am #4

Those textures would not be a problem on a PC, but on a mobile device they can be quite large. This also depends on the specific device you are using, but I would suggets to reduce each image to half of its size, i.e.:

512x512 

Also, the 1536x1536 are not power-of-two, you should reduce them to 1024x1024 or 512x512 as well.

 

out of memory when adding textures

April 24, 2013 - 9:23pm #3

sorry, i replied you too long..

these is my 7 texture that i said:

  1. TextSSumatera, 1024x1024px, 45Kb
  2. TextSKalimantan, 1024x1024px, 34Kb
  3. TextSSulawesi, 1024x1024px, 38Kb
  4. TextSPapua, 1024x1024px, 30Kb
  5. TextSJawa, 1024x1024px, 26Kb
  6. TextGunungSumatera, 1536x1536px, 83Kb
  7. TextGunungJawa, 1536x1536px, 124Kb

is my picture resolution or the size is too big?

out of memory when adding textures

April 21, 2013 - 6:46am #2

Hi, what is the size of these textures ?

Log in or register to post comments