Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 27 Dec 2008 10:24:58 +0100
Hi
Can I ask someone to help me on these two issues, please...?
1) Every now and then while updating a (small) part of the display the section being updated sort of flashes like if the modification takes place in the middle of a screen update. In the old days you could prevent this by waiting for a vertical blank sync signal before making your change. Languages like Blitz had a specific command for this. Is there a trick to achieve the same effect in Hollywood and prevent the flash effect?
You could try to use
VWait(). However, the flashes could also be due to coding mistakes, e.g. by drawing over the same area twice. This usually generates flickering. E.g. if you want to move brush 1 from 0:0 to 100:100, you should NOT do the following:
Box(0, 0, 200, 200, #BLACK) ; clear old area DisplayBrush(1, 100, 100) ; draw brush to 100:100
This will generate a flickering display. Instead you should do it in one drawing operation (e.g. by using an off screen brush etc.)
2) How does garbage collection work in this case...?
mylist={} mylist.mysublist={} mylist.mysublist[0]="Hello" mylist=nil
Can I expect Hollywood to remove the momory reserved for the sublist item as well or is it 'orphaned' and only killed when the computer is turned off? In other words, can I get rid of a multilevel table structure by simply setting the top level to nil? It will of course make the sub items inaccessible, but will they still grab some memory? I currently play around with some 5 level structures for a program, and it would be convenient if I could erase a structure in a clean way by just setting the top level to nil.
Yes, it works this way. As soon as a structure becomes inaccessible, it will be freed by the garbage collector automatically during run-time.