Am 12.07.2021 um 01:34 schrieb Kenneth:
> Is there a way to 'undefine' an image_map, once it has been loaded into memory
> during the parsing of a scene? So that its memory is 'released'? AFAIU, using
> #undef simply undefines the *identifier* for the image (not the image_map
> itself), which is not what I'm talking about.
As a general rule of thumb, whenever you "discard" an identifier's value
(because you `#undef` it, assign a new value, re-define it as a macro,
or whatever), any associated memory will automatically be released IF
there doesn't exist another reference to that data.
Additional references will typically be created when you:
- assign the value to another variable, or
- "attach" the value to some other scene element, e.g. use an
image-based pigment in an object.
Simply evaluating an image-based pigment will not create an additional
There are a few exceptions to this:
- Some data will always be copied, rather than additional references
- Some data will be cached because it is expected to re-occur later, and
is sufficiently complicated to process that it would be a waste to do it
all over again.
An example for the latter would be font files, which aren't discarded
even when a `text` object is discarded, because POV-Ray anticipates that
you might use the same font (and possibly also some of the characters)
in other `text` objects.
POV-Ray doesn't cache image files, so you should be fine with what
you're trying to do, even without any extra precautions.
> Is the efficient way to do this simply a matter of re-#declaring each 'new'
> image with the *same* identifier? (Assuming a proper-size array has already been
> pre-#declared to hold the eval_pigment results):
Post a reply to this message