RE: About Eu garbage collection

new topic     » topic index » view thread      » older message » newer message

Henri.Goffin at sbs.be wrote:
> Hi everybody!
> 
> It is probably to late to propose enhancement for 2.3 but maybe for the 
> next one.
> 
> Here's my problem. A program I am working on makes use of huge 
> sequences. Some of them - the biggest ones - are just used temporarily. 
> So I thought naively that when the routine was done extracting useful 
> data from thoses big sequences it would suffice to make 'huge = {}' to 
> free up memory. But nope.
> 
> It seems that once memory has been dynamically assigned to sequences 
> there is no way to free it until the program is done. Am i right?
> 
> - If no, can someone tell how this can be done? Re-using the same 
> sequence could be a solution but this strategy might be very tricky to 
> implement depending on the program logic
> 
> -If yes, could'nt it be thinkable to have (in a more or less remote 
> future) some routine built into Euphoria runtime that would free the 
> memory associated to specified objects whenever you know you don't need 
> those object at some point in your program? 
> 
> Henri Goffin

Henri:
  Have you tried processing your sequence inside of a function,
  the reason I say this is as far as I know any memory allocated
  inside of a function should be only temporary and released when
  the function is exited.

  function ProcessData( sequence DataFileName, integer process )
  sequence data
  
  if process = search then
    -- load data from a file into sequence data
    -- and search
    -- Write data out to result file
    return result_flag 
  elsif process =  strip commas then
    -- load data from a file into sequence data
    -- and strip
    -- Write data out to result file
    return result_flag 
  end if
  return result_flag 
  end function

Bernie

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu