[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Sorting & memory




I am using the MacPerl MPW tool 5.03. Not sure if it's current.

Three arrays, all numbers. I read them from a text file while I create a
fourth array which contains index values into the other three.

Now I use sort to create a fifth array which contains index values in a very
special sorting order. I have prepared a subroutine which makes the check
using values in the three arrays as indexed by $a and $b. The subroutine is
complex but doesn't explicitly declare any new memory.

The problem:

I simply can't sort more than about 600 items. Doubling the size of MPW to
16MB doesn't help. I still get "Out of Memory!" messages. Debugging
printouts confirm that I am getting to the sort command, but no further.

Works fine with 511 items, fails with 1011 which happens to be the next
count I want to use.

The questions:

How does the memory requirement scale with the count of sorted items?
Exponential?
Is there a slow but memory-conserving version of sort around?
Is this possible an MPW problem? Does MPW give all of it's heap to Perl?
Is MacPerl depending on MPW to interpret a malloc(3) request or is it doing
NewHandle, or, perish the thought, NewPointer system calls?

-> From the USA. The only socialist country that refuses to admit it. <-

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch