POV-Ray : Newsgroups : povray.general : image_map memory use-- question : image_map memory use-- question Server Time
29 Jul 2021 20:37:34 EDT (-0400)
  image_map memory use-- question  
From: Kenneth
Date: 11 Jul 2021 19:40:00
Message: <web.60eb801413d9db17d98418916e066e29@news.povray.org>
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.

Here's a rather nutty example, to describe what I mean:

Let's say I want to use eval_pigment to pick out a single pixel's color at some
location in an image, in maybe 10,000 different image_maps(!)that are
consecutively numbered-- stepping through each image in a #for loop, for
example. Each image_map itself is no longer needed after that step, and could be
eliminated. Otherwise, those 10,000 images could take up a lot of memory.

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):

#declare PIXEL_COLOR_ARRAY = array[9999];
#for(i,0,9999)
#local IMG = eval_pigment(...image_map and location...)
#declare PIXEL_COLOR_ARRAY[i] = IMG;
#end

Does the IMG variable just substitute one image_map for another, so that there's
only one image in memory at any one time? Or does the eval_pigment() macro
itself cause all 10,000 images to start accumulating into memory, without
'flushing' each image_map before it sees a new one? My understanding is that a
#macro does 'undefine' its #local variables automatically when the #macro use
has ended-- but again, that's just its *identifiers*, AFAIK-- not(?) any memory
that the #macro used.


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.