Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Garbage collection

Reply
Thread Tools

Garbage collection

 
 
Stuart
Guest
Posts: n/a
 
      04-28-2008
"Hallvard B Furuseth" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> With GC in safety-critical programs, the question is "will this be the
> time the collector pauses the program for a dangerously long time in
> order to do its job, or fails to collect enough memory?"
>
> With CBFalconer-code the question is "has cbfalconer.home.att.net
> recently been outsourced to some kid in India?"
>
> This is why GC is the best choice for safety-critical programs nowadays.


How do you conclude this from the two statements you made?

The first seems to describe a classically difficult problem and so indicates
that using GC creates a difficult to resolve safety issue.

The second appears to be trying to suggest some problem of being unsure as
to who actually wrote the code [I say appears because there are many
programmers on the Indian subcontinent, some quite youthful, who are very
skilled and well-educated - but this would make the conclusion even more
bizarre. So assuming it is some reference to the recurrent appearance of,
apparently Indian, students submitting coursework questions on this forum
and is intended to be derogatory...]. There are two immediate difficulties
from this suggestion:

1) The design/code is available for review (and typically for a
safety-critical system would be) so any shoddy work would be discernible.
Since establishing code quality is something that needs to be done for all
the safety-critical software this particular element of the code does not
seem to be posing any different or new problem.
2) Any concern about the people undertaking the design/coding of the
software would appliy to all the software - not just some element of it.

So the second statement is [ir]relevant irrespective of the use of GC.

Given this I fail to see how you draw your conclusion.

--
Stuart


 
Reply With Quote
 
 
 
 
Bartc
Guest
Posts: n/a
 
      04-28-2008

"Richard Heathfield" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Eligiusz Narutowicz said:

....
>> This is of course total rubbish. One can wrap malloc/free and log
>> mallocs and frees easily enough. You seem to be intent on making it into
>> some sort of impossible task. History states that it isn't. There are
>> plenty of reliable and long lasting C projects you know!

>
> It's not just easy. It's almost trivial.


Sure. Have a look at 4.26 p.59 here as to why they restrict use of
malloc/free. This is nothing to do with how able the programmer is:

"Chris Thomasson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> JSF C++ standards:
> http://www.research.att.com/~bs/JSF-AV-rules.pdf


And I mentioned (if I can quote myself!) regarding avoid use of malloc():

> Compare these two pieces of code:
> (1)
> char array[10000];
>
> (2)
> char *array;
> array=malloc(10000);
> if (array==NULL) puts("YOU'RE DEAD"); /* what else can it do? */


That's must be plenty of code examples so complex (I'm thinking in terms of
recursive stuff) where: (a) you can't determine easily if it will run out of
memory, even ignoring fragmentation issues; (b) nor whether you can always
balance malloc() and free(); (c) if malloc() fails recovery is next to
impossible.

So it can only be almost trivial where the program itself is almost trivial
(in complexity and runtime unknowns rather than in size).

--
Bartc



 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      04-28-2008
Bartc wrote:
> "Richard Heathfield" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Eligiusz Narutowicz said:

> ...
>>> This is of course total rubbish. One can wrap malloc/free and log
>>> mallocs and frees easily enough. You seem to be intent on making it into
>>> some sort of impossible task. History states that it isn't. There are
>>> plenty of reliable and long lasting C projects you know!

>> It's not just easy. It's almost trivial.

>
> Sure. Have a look at 4.26 p.59 here as to why they restrict use of
> malloc/free. This is nothing to do with how able the programmer is:
>
> "Chris Thomasson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> JSF C++ standards:
>> http://www.research.att.com/~bs/JSF-AV-rules.pdf

>
> And I mentioned (if I can quote myself!) regarding avoid use of malloc():
>
>> Compare these two pieces of code:
>> (1)
>> char array[10000];
>>
>> (2)
>> char *array;
>> array=malloc(10000);
>> if (array==NULL) puts("YOU'RE DEAD"); /* what else can it do? */

>
> That's must be plenty of code examples so complex (I'm thinking in terms of
> recursive stuff) where: (a) you can't determine easily if it will run out of
> memory, even ignoring fragmentation issues; (b) nor whether you can always
> balance malloc() and free(); (c) if malloc() fails recovery is next to
> impossible.
>
> So it can only be almost trivial where the program itself is almost trivial
> (in complexity and runtime unknowns rather than in size).
>


For Mr Heathfield all is trivial... He doesn't even need a debugger most
of the time. Superman comes to him to receive lessons in programming.

Now, he could be a millionaire because all people that buy expensive
malloc debugging tools would switch to his trivial method and pay HIM
instead of all those expensive tools...


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
Reply With Quote
 
Hallvard B Furuseth
Guest
Posts: n/a
 
      04-28-2008
I wrote:
> (...)
> With CBFalconer-code the question is "has cbfalconer.home.att.net
> recently been outsourced to some kid in India?"
>
> This is why GC is the best choice for safety-critical programs nowadays.


Clearly forgetting the "" was unfortunate. Sorry about that.

--
Hallvard
 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      04-28-2008
jacob navia wrote:
>
> For Mr Heathfield all is trivial... He doesn't even need a debugger most
> of the time. Superman comes to him to receive lessons in programming.
>
> Now, he could be a millionaire because all people that buy expensive
> malloc debugging tools would switch to his trivial method and pay HIM
> instead of all those expensive tools...
>

Na, I'll stick with the excellent and free tools my platform of choice
provides.


--
Ian Collins.
 
Reply With Quote
 
Stuart
Guest
Posts: n/a
 
      04-28-2008
"Hallvard B Furuseth" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I wrote:
>> (...)
>> With CBFalconer-code the question is "has cbfalconer.home.att.net
>> recently been outsourced to some kid in India?"
>>
>> This is why GC is the best choice for safety-critical programs nowadays.

>
> Clearly forgetting the "" was unfortunate. Sorry about that.


It would have clarified things somewhat

--
Stuart


 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      04-28-2008
Hallvard B Furuseth wrote, On 28/04/08 11:25:
> I wrote:
>> (...)
>> With CBFalconer-code the question is "has cbfalconer.home.att.net
>> recently been outsourced to some kid in India?"
>>
>> This is why GC is the best choice for safety-critical programs nowadays.

>
> Clearly forgetting the "" was unfortunate. Sorry about that.


Hey, it happens.
--
Flash Gordon
 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      04-28-2008
Ian Collins wrote, On 28/04/08 00:05:
> Flash Gordon wrote:
>> Actually, I would be most concerned with fragmentation since proving
>> that memory isn't going to get fragmented will be a real bitch.

>
> Which is why GC really only comes into its own when it is designed into
> a language from day 1.


I agree that is where it is most useful. Obviously it can also be used
with a slightly restricted C (as some people do), but for any given
feature a language designed with that feature will always do it better.
--
Flash Gordon
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
Templates - Garbage In Garbage Not Out ramiro_b@yahoo.com C++ 1 07-25-2005 04:48 PM
Garbage Collection kamran MCSD 1 04-04-2005 10:04 PM
Garbage Collection and Manage Code? Laser Lu ASP .Net 5 01-27-2004 03:48 AM
Debbugging help! (.NET 1.1 Framework Garbage Collection Problems) Cheung, Jeffrey Jing-Yen ASP .Net 3 07-10-2003 07:29 PM



Advertisments