Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

memory leak in loop

HI all - I'm fairly new to openCv and where hoping you could help me with this problem.

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage src, IplImage *dst, int filter_sel, int param1, int param2, int iterations) { int i; *dst = cvCloneImage(src); . . . for (i = 0; i < iterations; i++) { cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0); } }

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.

Any help would be greatly appriciated

  • Kind regards

memory leak in loop

HI all - I'm fairly new to openCv and where hoping you could help me with this problem.

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage src, *src, IplImage *dst, **dst, int filter_sel, int param1, int param2, int iterations) 
{
    int i;
    *dst = cvCloneImage(src);
        .
        .
        .
        for (i = 0; i < iterations; i++)
        {
        cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0);
        }
}

}

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.

Any help would be greatly appriciated

  • Kind regards

memory leak in loop

HI all - I'm fairly new to openCv and where hoping you could help me with this problem.

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage *src, IplImage **dst, int filter_sel, int param1, int param2, int iterations) 
{
    int i;
    *dst = cvCloneImage(src);
     .
     .
     .
     for (i = 0; i < iterations; i++)
     {
        cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0);
     }
}

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.

Any help would be greatly appriciated

  • Kind regards

memory leak in loop

HI all - I'm fairly new to openCv and where hoping you could help me with this problem.

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage *src, IplImage **dst, int filter_sel, int param1, int param2,  int iterations) 
{
    int i;
    *dst = cvCloneImage(src);
    .
    .
    .
    for (i = 0; i < iterations; i++)
    {
        cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0);
    }
}

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.

Any help would be greatly appriciated

  • Kind regards
click to hide/show revision 5
No.5 Revision

memory leak in loop

HI all - I'm fairly new to openCv and where hoping you could help me with this problem.

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage *src, IplImage **dst, int filter_sel, int param1, int param2, 
int iterations) 
{
    int i;
    *dst = cvCloneImage(src);
    .
    .
    .
    for (i = 0; i < iterations; i++)
    {
        cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0);
    }
}

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.

Any help would be greatly appriciated

  • Kind regards
click to hide/show revision 6
No.6 Revision

memory leak in loop

I'm using a simple for loop to do X itterations of the same filter:

void filterwrapper(IplImage *src, IplImage **dst, int filter_sel, filter_sel,
      int param1, int param2,  int iterations) 
{
    int i;
    *dst = cvCloneImage(src);
    .
    .
    .
    for (i = 0; i < iterations; i++)
    {
        cvSmooth( *dst, *dst, CV_MEDIAN, param1, 0);
    }
}

I'm aware i somehow have to release the memory using cvReleasimg(), but doing so inside the loop causes my program to crash. I've tried using a temporary image (IplImage *tmp) as a placeholder and releasing this each loop, but i still get an memory allocation error when running the program.