On Sun, Jul 6, 2014 at 2:13 PM, Sid <tmf...@gmail.com> wrote:

> I think you made a typo -- you're allocating an array of size 100,000
> rather than 1 million.
>

I just copied what you wrote in your original message.  When I run with 1
million, I get something close to what you reported, but the details of
that number have already been explained, I think.

Cheers!
   Kevin



>
> On Sunday, July 6, 2014 5:04:46 PM UTC-4, Kevin Squire wrote:
>>
>> I believe there is some work afoot on getting memory usage on a per-line
>> basis.  Until then, @profile is usually a reasonably good proxy, at least
>> on Linux and OSX--Windows has had some issues around this.
>>
>> That said, the original answer was the best one: this is a known issue,
>> and the best solution is probably to inline functions.  This is a
>> non-trivial change, so unfortunately probably won't happen in the very near
>> future.
>>
>> Incidently, the deprecation of the "order" keyword was removed on master,
>> so you won't be seeing that warning anymore.
>>
>> So? Temporary allocations take time and space, too, and as soon as the
>>> system starts swapping, both don't just add, but multiply.
>>>
>>
>> Interestingly, I only get 61Mb allocated for the same test that @Sid ran
>> (69Mb the first time, which includes compilation), which is much less than
>> 768Mb:
>>
>> julia> a = rand(100000);
>>
>> julia> @allocated sort(a, by=x->x)
>> 68840632
>>
>> julia> @allocated sort(a, by=x->x)
>> 60856624
>>
>>
>>> The correct question is: why does Julia allocate incredible amounts of
>>> memory even for the in-place sorting of an array, sometimes? When exactly
>>> does that happen, and how can we avoid it?
>>>
>>
>> 60Mb isn't that much, but it is still much larger than 8Mb.  Can you tell
>> me how much memory is allocated by Java or C++ for this?
>>
>> Cheers,
>>    Kevin
>>
>>
>>
>>>
>>> Am Sonntag, 6. Juli 2014 22:28:02 UTC+2 schrieb Kevin Squire:
>>>
>>>> It's likely that much of the memory was for temporary allocations that
>>>> were reused.
>>>>
>>>> Cheers,
>>>>    Kevin
>>>>
>>>>
>>

Reply via email to