[PD] Re: [GEM] pix_resize eating RAM

IOhannes m zmoelnig zmoelnig at iem.at
Wed Jun 15 10:51:33 CEST 2005


yes, i can reproduce the problem, although i am not really sure where it 
happens: i would like to blame gluScaleImage(), although i cannot really 
imagine this. (but commenting it out seems to fix the memory leak)

hmm, i'll have to make some further tests
probably writing the resizing function ourselves would be a good idea 
anyhow (gluScaleImage() seems to be rather slow)


Parser - Davide Morelli wrote:
> Hi list,
> 
> I am trying to resize a live video feed to a very small picture (16x12),
> extract a list of rgba values from this image and pass the list to ann_mlp.
> 
> On my system the pix_resize object keeps eating RAM over and over every time
> I pass it a pix. (see the attached patch)
> 
> Maybe either the unsigned char * resizedData or the old image.data should be
> freed somewhere?

freeing and allocation are handled by reallocate(), so this should be fine.
and the memory is leaking rather slow (but noticable) on my machine. if 
the resizedData would be allocated (but not free) each and every frame, 
i would have noticed the leak long before....

> 
> WinXP
> GEM 0.90 (compiled Aug 3 2004)
> Pd 0.38-3
> 
> Btw: in a old post
> (http://lists.puredata.info/pipermail/pd-list/2005-04/027626.html) I've read
> that pix_resize can be used with 2 args:
> [pix_resize X Y] to get an image Y height and X width
> But in the example patch attached it doesn't seem to work, and looking at
> the source code (pix_resize.cpp) I don't see how pix_resize could do that.
> ... Is there a way to reduce an image size?
> E.g. from 320x240 to 16x12 pixels?

you would have to compile the CVS version yourself for w32.

mfg.ads.r
IOhannes

> 
> Thank you,
> Davide.





More information about the Pd-list mailing list