PDA

View Full Version : Memory in (Un)Delphix



klanpaia
03-01-2010, 09:19 PM
Hi, I'm using this code to display images on the screen:


DXImage.Items[0].Draw(DXDraw1.Surface,round(x),round(y),0);


http://img705.imageshack.us/img705/3122/36831472.png
:o

I realized that every image loaded used more and more memory. How to release the memory used by the surface?

Traveler
04-01-2010, 11:54 AM
You can do that by not loading the images at design-time, but during run-time. However if you go that route you'll need to distribute the images with you executable.

noeska
04-01-2010, 05:54 PM
Also a call to <object>.free might come in handy. Do this after you are done displaying it and move to the next screen.

klanpaia
06-01-2010, 11:23 AM
You can do that by not loading the images at design-time, but during run-time. However if you go that route you'll need to distribute the images with you executable.

I understand, but I use the picture for 30 seconds and do not need it after that. Is there a way to release memory? ::)



Also a call to <object>.free might come in handy. Do this after you are done displaying it and move to the next screen.

I'll do that then I say if it worked :)
Thanks o/

Traveler
06-01-2010, 12:04 PM
Its been a while I used DelpphiX but iirc you can create an object TDirectDrawSurface and then use that to load and draw the image. When you nolonger need it you can release the object again.

klanpaia
08-01-2010, 09:25 AM
Thanks everyone



Its been a while I used DelpphiX but iirc you can create an object TDirectDrawSurface and then use that to load and draw the image. When you nolonger need it you can release the object again.


;) I will do this

I found a good example... \o/
http://www.pascalgamedevelopment.com/library_old/viewtopic.php?p=5526&sid=edff5eadf55749c599fd42d1f7cf82f6

ijcro
10-01-2010, 06:38 PM
Memory is managed internaly, you can use DxDraw1.ClearStack for force prune texture stack manually. But new restoring all used next screen texture consume more times, you be sure, that example level finished or menu screen is loaded etc.

klanpaia
02-02-2010, 08:40 AM
I understand :yes:
Thanks for help