Acknowledged

Out Of Memory error and Garbage Collector logic

I've got a watch face with following simplified code: 

class RunOrelView extends WatchUi.WatchFace {
    var logoToDraw;
    
    function onLayout(dc as Dc) as Void {
        logoToDraw = WatchUi.loadResource(Rez.Drawables.Bitmap1);
    }
    
    function onUpdate(dc as Dc) as Void {
        // take another bitmap if some condition met
        logoToDraw = WatchUi.loadResource(Rez.Drawables.Bitmap2);
    }
}

For the old devices with very limited that can store only one bitmap in memory, we'll get Out Of Memory exception on line 10 because the previous bitmap resource wasn't released.

Now let's change this:

logoToDraw = WatchUi.loadResource(Rez.Drawables.Bitmap2);

to this:

logoToDraw = null;
logoToDraw = WatchUi.loadResource(Rez.Drawables.Bitmap2);

and now everything works fine with no exceptions. Because we've freed resources manually? Why compiler can't do "logoToDraw = null;" by itself when I do variable assignments?