[Info-vax] Digital

Paul Sture paul at sture.ch
Wed Aug 1 06:36:23 EDT 2012


On Sat, 28 Jul 2012 17:49:47 +0000, ChrisQ wrote:

> On 07/28/12 16:56, Paul Sture wrote:
> 
>> Yes, and there is overhead in deallocating dynamic strings once done
>> with as well.
>>
>> Imagine a tight loop building up a long record a byte at a time by
>> doing something like this
>>
>>    x = x + y
>>
>> where that is the syntax for creating new string x by concatenating old
>> string x and string y, then discarding old string x, you get the
>> picture.
>>
>> FWIW in one of my early attempts with Objective-C I was attempting a
>> similar operation to build a long string.  Although I was adding
>> substantially more than one byte at a time, the loop was too tight, the
>> garbage collector couldn't keep up and I ended up with a gloriously
>> unstable system :-)
>>
>>
> That sort of thing is the sort of thing many of us have made early in
> our programming careers, but the understanding you gain from that is
> invaluable.
>
> If you never make a mistake, then you never made anything :-).

That's very true.
 
> Have no experience of Objective C, but anything involving memory
> allocation or GC would be avoided like the plague for most embedded
> work, since available resources are usually limited. More importantly,
> it introduces a level of indeterminacy that is not visible to the
> programmer. Good software design requires that programmers should know
> up front how much memory is needed at any point and plan accordingly. I
> don't use C++ for the same reason, though it does seem to be gaining
> popularity for embedded work...

Likewise with a lot of the stuff I used in my early career; all the 
memory required was allocated at program initialisation and if that 
succeeded you were good to go for the execution lifetime.


-- 
Paul Sture



More information about the Info-vax mailing list