Out of memory error

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

Robert Craig mistakenly said:
>  2. filesort.ex makes a full copy of the input data, i.e.
>
>             sorted_buffer = sort(buffer)
>
>      creates a second sorted copy of the input data. If
>      you were to use something like great_sort of allsorts.ex you
>      could sort buffer in-place.

Actually Euphoria *won't* copy the data. If buffer is a sequence
of 10000 strings, Euphoria will create a new sorted sequence for sorted_buffer
that uses 10000 pointers (x 4 bytes each = 40000 bytes). After sorting,
each string will be pointed to from one element of buffer and one element
of sorted_buffer. There will only be a single copy in memory of each
string.

As a Euphoria programmer these "pointers" are not visible to you
unless, Michael, you are a "Euphoria Guru", or you are wearing an
excellent pair of 3-D glasses. Euphoria creates the illusion that
buffer and sorted_buffer contain 2 distinct copies of all the data.

Conclusion: An in-place sort would only save a small percentage
of the total memory required here.

Regards,
  Rob Craig
  Rapid Deployment Software

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

Search



Quick Links

User menu

Not signed in.

Misc Menu