Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Clearing an image sheet from memory
Started by sporkfin Nov 13 2019 01:33 PM

5 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

OK, when I'm finished with and image sheet and want to remove it from memory I just nil it out?

myImageSheet = nil

Is that it?  Since it is a graphics call instead of a display I don't use display.remove( ) but is there anything else I need to do to release it from memory?

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

I believe that should work. You could print out the texture memory used before you nil it, then garbage collect, and then print the texture memory out afterwards and make sure it goes away.

 

Rob



[TOPIC: post.html]
#3

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

Thanks Rob.  I tried to run the image sheets through my standard kill function but display.remove( ) tripped up the removal.  I'll run some tests.



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,020 posts
  • Corona SDK

I'm here again with my "If I remember correctly..." replies :D

IIRC, that's exactly how it works. I did a lot of these graphics tests some time ago.

 

I also thought about your other post where you talked about creating lots of display objects, each with their own image sheet object (or something along those lines). While that shouldn't increase the texture memory use at all, it means creating additional tables, which will cost additional memory. But, I was just curious as to why you'd need to create multiple instances of the same sheet instead of just one?



[TOPIC: post.html]
#5

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

@Xedur - I have a table where certain names call up certain image sheets and their parameters - it makes it easy to change the content of each image sheet as they are still a work in progress (e.g. which sprites will live where for maximum texture packing).  The downside is that each sprite creates a new image sheet. 

 

I plan to finalize in image sheets in the end but until then I'm using this loose system.  I have some memory leaks between levels and within levels and there are some indicators that it might be sprite related so I'm checking all the boxes.



[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

Image Sheets are not display objects, so they won't have all the display object methods, like .remove(). They are also designed to have multiple display objects created from a single image sheet and not take up more memory. I'm not sure if we intended for them to be unloaded.

 

Rob




[topic_controls]
[/topic_controls]