def color_list_free_up_memory(self):
        """Clear objects/delete references to free memory."""
        ### Clear the list of color-related objects.
        ###
        ### by default, entering the colors viewer for the
        ### first time will always land in the color list
        ### mode, which will trigger the creation of this
        ### list;
        ###
        ### however, in the case we ever decide to make
        ### another mode the default one, the list wouldn't
        ### exist when this clearing operation is attempted,
        ### so we wrap it in a try/except clause to guard
        ### against AttributeErrors

        try:
            self.color_list_objs.clear()
        except AttributeError:
            pass

        ### also delete the attribute referencing the
        ### list of colors being displayed
        ###
        ### this doesn't save much memory, but forces the
        ### color-related objects to be created again
        ### the next time the user enter the colors viewer;
        ###
        ### it is necessary to guard the statement against
        ### AttributeError here because let's suppose the
        ### user enters the colors viewer, then leaves with
        ### another mode on; the next time the user enters,
        ### the color list mode may not be visited again,
        ### which will make it so this attribute won't be
        ### created, so, when the user leaves again and
        ### we try to delete this attribute, this would
        ### raise an AttributeError since the attribute
        ### wouldn't exist

        try:
            del self.color_list_colors
        except AttributeError:
            pass
Clear objects/delete references to free memory.
nodezator/colorsman/viewer/modes/colorlist.py