exception_access_violation using SavePixmap

BlitzMax Forums/BlitzMax Beginners Area/exception_access_violation using SavePixmap

4mat(Posted 2011) [#1]
Hi,

I'm making a video using BlitzMax to save consecutive frames. But when I use the SavePixmap commands eventually I'll get an "EXCEPTION_ACCESS_VIOLATION". (usually around 540 frames into the recording) At a wild guess I'm assuming it's continually creating new frames and running out of memory or something?

Having used Image buffers in the old versions of Blitz I was assuming there'd be some way to just free the Pixmap with a command after saving it. All I'm doing is:

		image = GrabPixmap(0,0,1280,720)
		SavePixmapJPeg image,pic$
		image = Null


I tried putting GCCollect() in and using the GCSuspend() and GCResume() from some forum posts, but obviously I'm misunderstanding what Pixmap is actually doing in the first place. :) Any ideas?

thanks. 4mat.


H&K(Posted 2011) [#2]
deleted

Last edited 2011

I originaly posted use "Clearpixels", but now Im thinking, just dont bother with the Image = null thing

Last edited 2011


Brucey(Posted 2011) [#3]
Too many file handles open?
Or, some reference hanging around somewhere...

If you were using a Mac, you could run it through the leak checker that comes with XCode, and it would tell you exactly what object was leaking (if anything).


4mat(Posted 2011) [#4]
thanks for the suggestions, unfortunately I'm on PC. Using GCMemAlloced() it looks like some garbage collection is going on. (edit: with GCCollect() I can see it's adding about 1k to the internal memory alloc per frame)

I removed the 'null' line but still have the same problem, it's definately in the line:

image = GrabPixmap(0,0,1280,720)


So is the GrabPixmap just allocating another bitmap each time do you think? Would a StaticPixmap fix that?

As an alternative I wrote a quick .bmp writer and then realised it can't do the old blitz ReadPixel off the backbuffer. :) (unless I'm missing something)

Last edited 2011


Czar Flavius(Posted 2011) [#5]
What is the leak checker and how does it work?


4mat(Posted 2011) [#6]
ah, I seem to have fixed it a bit with:

Release(image)



TomToad(Posted 2011) [#7]
Is Image a TPixmap? You shouldn't need to release it if it is. From your description, I'm getting the impression you are allocating memory for the pixmap, then calling GrabPixmap, but GrabPixmap allocates it's own memory so Image no longer points to your buffer and therefor never gets collected by the GC.
Be sure and put Superstrict at the top of the program to catch those type of errors.