Announcement

Collapse
No announcement yet.

Merging In The GNU D Language Compiler To GCC

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    Not returning pointers to things allocated on the stack is easier then working around garbage collector crud. In fact, I'd imagine it's not hard for a compiler to warn you any time you do so.

    BTW, another reason why garbage collection is a pain: after you gave your text editor the 1GB that it needs to run happily with garbage collection without long pauses, then it gets swapped out, then you open it up again and type something, it has to swap most of that memory back in so it can do a garbage collection.

    Comment


    • #47
      Originally posted by movieman View Post
      Not returning pointers to things allocated on the stack is easier then working around garbage collector crud. In fact, I'd imagine it's not hard for a compiler to warn you any time you do so.
      Obviously you noticed that the compiler do not have information about who has the ownership of life-cycle of the objects and I do agree that some class of problems can be solved in a lot of nice ways, was a real case when you can make mistakes and is real code. Also was reflecting the point that faster stack operations can lead to other risks. In general missing of GC means that you simply don't know for a pointer (excluding is NULL) that is valid or not (because can be deleted).

      Originally posted by movieman View Post
      BTW, another reason why garbage collection is a pain: after you gave your text editor the 1GB that it needs to run happily with garbage collection without long pauses, then it gets swapped out, then you open it up again and type something, it has to swap most of that memory back in so it can do a garbage collection.
      You did it wrong to give 1GB of memory to your text editor. Big heaps are used for big, long running applications. Anyway, did you notice that swapping can happen for C++ applications too? Did I miss something about OS architectures? In fact there are cases when independent of memory allocation strategies of different runtimes. For example Android will drop applications (in multitasking) based on memory usages.
      At the end there are applications that do less, using C++ and use more memory than ones that use a GC. SharpDevelop loading the same projects (I tried for a 1000 classes project, SD will use 120M RAM, when VC# will use 140) will give consistently less memory usages that Visual C# Express, and reflects in almost 1:1 functionality. IntelliJ IDEA is fairly lean IDE. I am not justifying that writing counting every byte will not make C applications leaner, but people do not write in this way anymore.
      Also as it was talked earlier GC algorithms are different, so there are desktop GCs which are small pause to increase responsiveness. If you use Ubuntu and it happen to use Banshee, I did not notice it to swap. If you used an installer of Ubuntu or Fedora, you probably noticed the killer pauses of the GC as the live ISO remained without RAM (pun intended!).
      In fact there are so many GC based applications compared with the wisdom that they are too clumsy (Flash, Mono/.Net/Java, JavaScript, Python, Ruby with Rails), that I still wonder why there are people that are just defending irrationally the C++ language mechanics, when obviously other mechanisms work too. At the end the "managed" world is much bigger than a memory allocator abstraction, most people will use today SQL, and no one seem to attack it in case that it has other problems, like: what if the query is not well optimized and instead of 10ms will take 10 seconds to compute, also that there are enterprise like behaviors (Oracle, SQL Server, MySQL, and so on) which are optimized for throughput, which (obviously) behave different than an SQLite or Firebird. And applications use both, what if the database server will use huge memory that is not a part of application creator. What if when you execute a query, the server would use memory that enters on swap (remembering me on GC talks).
      My observation: best tool (not only in raw performance terms, but in the way that problem is really solved, maintenance costs, skill set, and so on) for the needed problem.

      Comment

      Working...
      X