Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak in Algorithms.Cast function?

I have the following line in my code:

 

Algorithms.Cast(OrigImage, tempRGB, ImageType.Rgb32)

OrigImage is a U8. It appears to have a 7mb memory leak.

 

Before: 81168K,

After:    88560K

 

Has anyone else noticed this? Is there a fix?

 

Note: I properly dispose of all images when I am done using them.

 

Thanks!

0 Kudos
Message 1 of 6
(4,803 Views)

Hi Steverino,

 

I checked our database but I wasn't able to find any documentation about this issue. Have you been able to make any progress on this since it was posted?

0 Kudos
Message 2 of 6
(4,750 Views)

I am not sure I know what you mean by making progress. Unless I am missing something, I am convinced the error is with the library. I spent a couple of hours trying to locate the source of the momory leak in my code and believe I found it.

 

I am wondering if someone at NI or another user can confirm this.

0 Kudos
Message 3 of 6
(4,729 Views)

Can you describe the situation a little bit more? What memory are you refering to when you say "Before: 81168K, After:    88560K"? Are you talking about the total amount of memory reserved by the application?

 

The cast function will convert an image of one type to another. If you were going from a U8 image to an RGB 32, the new image would require about 12 times the memory as the original image. 7 Mb would be a reasonable amount of memory increase for this process.

 

Jeremy P.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(4,704 Views)

I understand what you're saying.  The problem is that the memory is not reclaimed after doing an image.Dispose on the newly created image.

 

Try it out for yourself and see if you get a similar result. Maybe l'm missing something.

 

Thanks!

 

 

0 Kudos
Message 5 of 6
(4,699 Views)

Hi Steverino,

 

When you use the dispose function, is no memory reclaimed at all, or is only the extra memory from using the cast function to convert reclaimed?

0 Kudos
Message 6 of 6
(4,617 Views)