new D2.0 + C++ language

Weed resume755 at mail.ru
Fri Mar 20 02:01:59 PDT 2009


BCS пишет:
> Hello Weed,
> 
>> BCS ?????:
>>
>>> Reply to Weed,
>>>
>>>> If you know the
>>>> best way for language *without GC* guaranteeing the existence of an
>>>> object without overhead - I have to listen!
>>> Never delete anything?
>>>
>>> One of the arguments for GC is that it might well have /less/
>>> overhead than any other practical way of managing dynamic memory.
>>>
>> Mmm
>> When I say "overhead" I mean the cost of executions, and not cost of
>> programming
> 
> So do I.
> 
> I figure unless it save me more times than it costs /all/ the users, run
> time cost trumps.
	
This is a philosophical dispute.

A good and frequently used code can be written once and then used 10
years in 50 applications in 10000 installations. Here, the costs of
programming may be less than the cost of end-user's time and hardware.

>>> Yes you can be
>>> very careful in keeping track of pointers (not practical) or use
>>> smart
>>> pointers and such (might end up costing more than GC)
>> I am do not agree: GC overexpenditure CPU or memory. Typically, both.
> 
> ditto naryl on CPU
> 
> As for memory, unless the thing overspends into swap and does so very
> quickly (many pages per second) I don't think that matters. This is
> because most of the extra will not be part of the resident set so the OS
> will start paging it out to keep some free pages. This is basically free
> until you have the CPU or HDD locked hard at 100%. The other half is
> that the overhead of reference counting and/or the like will cost in
> memory (you have to store the count somewhere) and might also have bad
> effects regarding cache misses.

Once again I repeat: forget about reference counting - it is only for
the debug purposes. I think this addition should be switchable by
compiler option.

It did not included into the resulting code. Ref-counting needed for
multithreaded programs, when there is a risk to get and use a reference
to an object that another process has already been killed. This
situation needs to be recognized and issued to a run-time error.

This is addition to synchronization of threads, which is realized in D.



More information about the Digitalmars-d mailing list