Out of memory error
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM> Apr 26, 1997
- 534 views
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