new D2.0 + C++ language

Weed resume755 at mail.ru
Thu Mar 19 09:41:43 PDT 2009


Robert Jacques пишет:

> *sigh* All memory allocation must make some kernel calls. D's GC makes
> fewer calls than a traditional malloc. Actually,  modern malloc
> replacements imitate the way GCs allocate memory since it's a lot
> faster. (Intel's threading building blocks mentions this as part of its
> marketing and performance numbers, so modern mallocs are probably not
> that common)
> 
>>
>>> and 2) requires a
>>> global lock on access.
>>
>> Who?
> 
> Traditional malloc requires taking global lock (and as point 1, often a
> kernel lock. Again, fixing this issue is one of Intel's TBB's
> marketing/performance points)
> 
>>> Yes, there are several alternatives available
>>> now, but the same techniques work for enabling multi-threaded GCs. D's
>>> shared/local model should support thread local heaps, which would
>>> improve all of the above.
>>
>> It does not prevent pre-create the objects, or to reserve memory for
>> them in advance. (This is what makes the GC, but a programmer would do
>> it better)
> 
> I think the point you're trying to make is that a GC is more memory
> intensive.

+ Sometimes allocation and freeing of memory in an arbitrary
unpredictable time  unacceptable. (in game development or realtime
software, for example. One hundred million times discussed about it
there, I guess)

> Actually, since fast modern mallocs and GC share the same
> underlying allocation techniques, they have about the same memory usage,
> etc. Of course, a traditional malloc with aggressive manual control can
> often return memory to the kernel in a timely manner, so a program's
> memory allocation better tracks actual usage as opposed to the maximum.
> Doing so is very performance intensive and GCs can return memory to the
> system too (Tango's does if I remember correctly).
> 

I think so: during the performance of malloc is controlled by the OS.
And it is so does the optimization of memory allocation for programs.
And OS has more facilities to do this. GC there will be just extra layer.

A need language that does not contain a GC (or contains optional). Many
C++ programmers do not affect the D only because of this.



More information about the Digitalmars-d mailing list