OSNews article about C++09 degenerates into C++ vs. D discussion

Walter Bright newshound at digitalmars.com
Mon Nov 20 11:35:03 PST 2006


Miles wrote:
>> The poster who claimed that conservative gc is somehow incompatible with
>> cryptographic software is misinformed. Even if he were correct, the
>> cryptographic buffers could be allocated with malloc() and would then
>> have no effect whatsoever on the gc.
> 
> Using two allocation methods in the same process address space looks
> really bad, not to say hackish.

I strongly disagree. A complex application has different needs for 
different structures in the program. Just like OOP isn't the solution 
for every programming problem, one allocation method isn't either.


> And you don't need cryptographic buffers
> or multimedia data, a single int variable is enough to hold a large
> block of unused data in memory, and the larger the block is, the easier
> it is for this to happen. Even if it was 1/2^32 of chances of this
> happening, it still will happen.

In real, long lived gc applications I've been involved with, this is 
much more of a theoretical problem than an actual one. I found it 
surprising how little of a problem it actually was in practice.

The reason for this is not so obvious. It isn't "random" with a 1/2^32 
probability, that integers (and other types) contain random values with 
an even distribution. They don't. The overwhelming majority of ints have 
values that are between -100 and +100. The most common value is 0. Those 
values are nowhere near where the gc pools are located.



More information about the Digitalmars-d mailing list