Log in or register to post comments

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 12:48am #1

Hi,

I am getting Memory Leaks (with Heavies Backtraces Message) in QCAR Class and on line " NSInteger initSuccess = QCAR::init();" when call init() function, and for this app couldn't load on device and crash. Don't know where this Function defined. Please help me on that, i am stuck over here from 2 days. Thanks in advance.

Getting Memory leaks on QCAR Class and Could App Crash.

September 12, 2012 - 2:51am #12

If you look in the build/include/QCAR library you will find all the include files which you can drag into XCode.

Init() starts up the Vuforia library.

The leaks are not the problem in this particular case.

N

Getting Memory leaks on QCAR Class and Could App Crash.

September 11, 2012 - 6:56am #11

Log show error "EXC_BAD_ACCESS" in log and i also run program on intrument with leaks and it show only leaks in "QCAR Class and on line " NSInteger initSuccess = QCAR::init();" with is in QCAR library but couldn't find where it is defined. If you've idea please let me know. Thanks

Getting Memory leaks on QCAR Class and Could App Crash.

September 11, 2012 - 6:22am #10

1) What does the XCode log say?

2) Given that it is crashing in OpenGL ES have you tried checking for any OpenGL errors?

3) Have you tried running it through Instruments checking a)memory b) leaks and c)OpenGL Analyser ?

Failing all of these you could try going back to the sample code which draws the teapot and start again from there - as this should work on all platforms.

 

N

Getting Memory leaks on QCAR Class and Could App Crash.

September 11, 2012 - 4:55am #9

I am asking about crashed which are occouring in my app, actually i am drawing a rectangular, using following code, and this code is only crash on IOS4.3 but works fine on IOS 5.1 or Later, don't know what happened. If you can help or give me any hint where i doing wrong

QCAR::Matrix44F modelViewProjection;

                    

                    glColor4f(0.5f,0.0f,0.0f,0.0f);

                                    

                    ShaderUtils::multiplyMatrix(&qUtils.projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);

                    glUseProgram(shaderProgramID);

                    glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &vbVertices[0]);

                    glEnableVertexAttribArray(vertexHandle);

                    glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] );

                    glColor4f(0.5f,0.0f,0.0f,0.0f);

                    

                    glEnableClientState (GL_VERTEX_ARRAY);

                    glEnableClientState (GL_COLOR_ARRAY); 

                    glEnableClientState(GL_COLOR_ARRAY);    

                  //  glColorPointer(4, GL_FLOAT, 0, triangleColors);  

                    glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &vbVertices[0]); 

                    glDisableClientState(GL_TEXTURE_COORD_ARRAY);

                    glDisable(GL_TEXTURE_2D);

                    glDrawArrays(GL_LINES, 0, 8);

                    //glDisableClientState(GL_TEXTURE_COORD_ARRAY);

                    //glDisable(GL_TEXTURE_2D);

                    glDisableVertexAttribArray(vertexHandle);

"

and error occour on "glColor4f(0.5f,0.0f,0.0f,0.0f);" line

Getting Memory leaks on QCAR Class and Could App Crash.

September 11, 2012 - 2:30am #8

Hi Aleem,

Sorry, not sure what you are asking?

N

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 11:15pm #7

Thanks Nalin, Yes this is issue, but i don't know where i did wrong, and i also use this line "if([QCARutils getInstance].appStatus == APPSTATUS_CAMERA_RUNNING)" in code. Thanks again.

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 7:00am #6

Hi Aleem

In answer to your questions:

1 - this is a bug i.e. a known issue - some of these only come to light after tests on a range of devices :)

2 - you can try it, possibily with a combination of if([QCARutils getInstance].appStatus == APPSTATUS_CAMERA_RUNNING)

3 - this is more likely to be a bug at your end, possibly due to device differences or something that you are doing that works fine on some devices but not on others.  One suggestion is to check for OpenGL errors and also see what the log says.  You could also try commenting out code sections to find the offending lines...

 

HTH

N

 

 

 

 

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 6:41am #5

Thanks Nalin it Worked, but i've 3 questions.

1- What i did wrong, why we do this approach?

2- Can we reduce "canUseFrame" static integer from 100, because it take bit time to load app.

3- I've 3 device one iPhone 4S, and 2 iPhone 4. Now My app works fine on 4S(IOS 5.1) and one 4(IOS 5.1) but one iPhone4(IOS 4.3) still cause an error, when it detect marker on line "glColor4f(0.5f,0.0f,0.0f,0.0f);" which is same function "renderFrameQCAR" and error is "Thread 10: EXC_BAD_ACCESS (code=2, address=0x0)".

For more Clearification of what i am doing where crash happen, Code is:

QCAR::Matrix44F modelViewProjection;

                    

                                      

                    glColor4f(0.5f,0.0f,0.0f,0.0f);

                    ShaderUtils::multiplyMatrix(&qUtils.projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);

                    glUseProgram(shaderProgramID);

                    glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &vbVertices[0]);

                    glEnableVertexAttribArray(vertexHandle);

                    glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] );

                    glColor4f(0.5f,0.0f,0.0f,0.0f);

                    

                    glEnableClientState (GL_VERTEX_ARRAY);

                    glEnableClientState (GL_COLOR_ARRAY); 

                    glEnableClientState(GL_COLOR_ARRAY);    

                  //  glColorPointer(4, GL_FLOAT, 0, triangleColors);  

                    glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &vbVertices[0]); 

                    glDisableClientState(GL_TEXTURE_COORD_ARRAY);

                    glDisable(GL_TEXTURE_2D);

                    glDrawArrays(GL_LINES, 0, 8);

                    //glDisableClientState(GL_TEXTURE_COORD_ARRAY);

                    //glDisable(GL_TEXTURE_2D);

                    glDisableVertexAttribArray(vertexHandle);

"

 Thanks Again :)

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 3:49am #4

Hi Aleem,

There is a known issue regarding accessing getFrame() before everything is fully initialised, so one option is to wait a set number of frames e.g.

    static int canUseFrame = 0;

    

    QCAR::Frame frame = state.getFrame();

    

    if (canUseFrame > 100)

    { 

        for (int i = 0; i < frame.getNumImages(); i++)

        {

            

            const QCAR::Image *qcarImage = frame.getImage(i);

 

            

            NSLog(@"Creating frame image %d   pixel format  %d", i, qcarImage->getFormat() );

 

            

            if (qcarImage->getFormat() == QCAR::RGB888)

            {

                self.backgroundImage = [self createUIImage:qcarImage];     

                break;

            }

     

     

        }

    }

    else 

        canUseFrame++;

Another option you could try apart from using a count here is this line:

    if([QCARutils getInstance].appStatus == APPSTATUS_CAMERA_RUNNING)


HTH

N

 

 

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 2:03am #3

Sorry it is not "Heavies" it is "Heaviest Backtrace" which show in Instrument with Leaks option, it mean that it has too much leaks. I also couldn't find this function but it is use in "QCARutils" class "- (void)initQCAR" function.

This application works fine on iphone4S but when i try to install on iPhone 4 its crash and Exact lines are " QCAR::Frame frame = state.getFrame();

 

       

        //NSLog(@"Images: %d", frame.getNumImages());

        for (int i = 0; i < frame.getNumImages(); i++)"

with message EXC_BAD_ACCESS. It on building time so that app couldn't install on device. Don't know the reason. Kindly help me on that. Thanks in advance.

Getting Memory leaks on QCAR Class and Could App Crash.

September 10, 2012 - 1:43am #2

Hi Aleem

This function is in the Vuforia library, and it should not be causing a crash.

"Heavies" - not sure what you mean

Can you please provide some more information so we can help you?  e.g. what are you trying to do, what device, how did you build your app etc. and when exactly is it crashing?

N

Log in or register to post comments