forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

what happens to a image passed back from a function?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
matriculated



Joined: 04 Mar 2006
Posts: 31

PostPosted: Sun Mar 25, 2007 2:07 pm    Post subject: what happens to a image passed back from a function? Reply with quote

I have a function that returns an image. But what happens if I don't assign it to anything - like this:

screen:blit(0, 0, gradient(480, 16, white, black))

Where the function, gradient, creates an image of width 480 and height 16 with a color gradient going from white to black. So what happens to the results of the function? Does it get disposed of immediately?
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Mon Mar 26, 2007 6:20 am    Post subject: Reply with quote

With the collect garbage function Theortically is disposed of within a certain ammount of time. Which is about 30sec to 1 min. Which means the image returned is still taking a chunk of the memory for a while.

Results of functions act exactly like variables that are set and then immediatly set to nil after use.

Example
Check memory
load an image..
Display that image
Remove that image
Check Memory

The loaded image is still loaded into memory by checking the memory in the ram. It will not be cleared until the garbage collection is used.
Back to top
View user's profile Send private message
matriculated



Joined: 04 Mar 2006
Posts: 31

PostPosted: Mon Mar 26, 2007 8:54 am    Post subject: Reply with quote

Thanks for clearing that up!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group