Re: GC performance - GC fragility



Jolyon Smith wrote:
In article <47ad597e$1@xxxxxxxxxxxxxxxxxxxxxx>, Andre Kaufmann says...
[...]
Why should I do this as an expert?

This is an all too familiar protestation. Somehow being an expert makes taking care of details "beneath" us?

I take care (and dare to say that I'm somewhat more experienced ;-) ).

It's the ability and willingness to pay attention to details that MAKES us experts!

I rather prefer to know the details, but having not to care about them (permanently) during coding.


I rather would let the compiler create code to check in the debug version, if somethings has been coded wrong. E.g. .NET will raise an error if you use STA GUI objects from another thread.

But .net won't even whimper if your application simply consumes memory or even haemhorrages it.

Well a simple .NET application, which does nothing more than allocating memory in an endless loop doesn't eat all the systems memory.
On my system it needs roughly 1,2 MByte.

An access violation may not be the most elegant failure condition but it does at least highlight a problem in the code, and one that automated testing procedures should identify before the code makes it out into the wild.

I prefer to be notified about a problem immediately, than having to wait till the access violation occurs. Generally this kind of application failure hides behind undefined behavior and access violations occurring in different places.

O.k. let's take a simple example:

imho Simple examples are custom made for GC's - a complex example is more useful. But, if you insist...

Hard to describe or post complex examples in a newsgroup. ;-).

[...]
Wrong question. The real question is more complicated since it necessarily involves knowing or asking what the particular application in question is doing by keeping those 10 references in those 10 lists.

It may be that a reference count is required.

Yes, this would be the kind of solution for the problem I was thinking about. Reference counting is perhaps an appropriate solution for native applications, though might have more overhead than a garbage collection, since an Interlocked Instruction is "quite expensive" especially if multiple cores are involved.

[...]
And, of course, when I delete/free the object in question, in a non-GC env that object is free'd at that point. In a GC environment it may not be collected for some time, if ever.

In .NET you shouldn't have to care about the memory that much, but rather the resources. E.g. a Bitmap, which can hold MBytes of native memory, which the GC perhaps doesn't know about.
For these kind of resources even in a GC environment reference counting (or as you wrote some kind of listener/observer abstraction in the lists, which hold the resource objects) is needed.

I have to agree, that resources aren't handled by a GC, at least not as they should be handled - freed immediately and not by a finalizer.

I don't know what you mean with contracts in this context.

In your example: An object exposed by a DLL - who owns the object.... a "contract" in this context would be the documentation for the API that exposed that object.

Thank you for the explanation.


Attention - why should I regularly pay for something what the compiler could do for me automatically.

Because it can't do it as well as you can. You aren't "paying" your getting a benefit!

Well IMHO the compiler can do it better. E.g. in C++ the objects are truly embedded and allocation occurs if an object embeds 100 other objects only once on the heap or on the stack. In Delphi I have to use records, otherwise allocation a single object would result in 100 allocation calls to the heap. Why should I pay for it, if the compiler can do it better ?

The answer is C++ is quite complex and so is the coding. I can code quite faster in Delphi and IMHO even more faster in .NET.

You don't "pay" for using a GC, your users/customers do, every time they use your application. Ultimately of course, they presumably pay you in actual $$'s, so they had better feel they are getting good VFM from your application....

;)

I suppose you mean (WinForms) UI responsiveness, which is rather a problem of the GUI layer (GDI+) than of the GC, if the application. There are other kind of applications, where I wouldn't use .NET too.
(No doesn't mean that .NET application can't have a responsive GUI ;-) )

If my (type of) application has a significant performance decrease, when using .NET compare to the native implementation then yes, I wouldn't let the customer pay for it.

If I can code a little tool, way more faster in .NET then why should I let the customer pay for the additional time needed to code in a native language or a highly optimized assembly coded version ?
If both have a comparable execution speed and coding time, then I would agree and prefer native applications.

For example some 3D ego shooters have been coded in Java (surely not entirely). I can't differentiate, regarding responsiveness, if one is written in native code or uses managed code.

Yes, but I don't permanently want to eat - I would be going fat by doing this ;-).

Really?

I honestly can see only one time when I could stop eating - shortly before I stop breathing.

;)

Perhaps it's rather a question on eating not too much and too few, either
in the native or in the managed world.

;-)

Andre
.



Relevant Pages

  • Can I have back my destructors, please?
    ... In C++ you have RAII idiom that takes care of all your resources - ... memory, file handles, etc. ... make the consumer code uncompilable after such change?). ...
    (microsoft.public.dotnet.languages.csharp)
  • Can I have back my destructors, please?
    ... In C++ you have RAII idiom that takes care of all your resources - ... memory, file handles, etc. ... make the consumer code uncompilable after such change?). ...
    (microsoft.public.dotnet.languages.vc)
  • Re: REGION=0M and LSQA
    ... At the time, memory was very expensive, and we ... remaining storage and always issued a return code zero. ... programs actually worked in production, ... all of the resources used by the job up until that point ...
    (bit.listserv.ibm-main)
  • Re: GC performance - GC fragility
    ... I take care ). ... memory in an endless loop doesn't eat all the systems memory. ... reference an object that has been collected in the same way that you can ... otherwise allocation a single object would result in 100 ...
    (borland.public.delphi.non-technical)
  • Re: A realistic price comparison
    ... > Spreading Apple FUD is just as bad as spreading Microsoft FUD. ... > However, I assure you, I had more than enough resources on my XP ... > instilled in them by having limited memory and disk space early on. ...
    (comp.sys.mac.advocacy)