Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #86603

Re: manual memory management, vs an automatic gc...

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: manual memory management, vs an automatic gc...
Date 2022-09-26 08:29 +0000
Organization Aioe.org NNTP Server
Message-ID <tgrnsa$bj0$1@gioia.aioe.org> (permalink)
References <tgl32i$2l0h0$1@dont-email.me>

Show all headers | View raw


Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> I have conducted a lot of experiments in the past with garbage collected 
> languages, and have come to a conclusion. Manual memory management 
> techniques can be a good thing, even in a GC environment. Iirc, I wrote 
> about it here before, many years ago.
> 
> Being able to create objects all over the place willy-nilly, and never 
> even have to think about destroying them... Is a "convenience" that a GC 
> can help one out with...

I think that as data-oriented design (as opposed to object-oriented design)
is gaining popularity, especially in certain fields of programming that
require extreme efficiency (such as game engines), the need for automatic
garbage collection is diminishing, at least in those fields.

The problem with automatic GC is that it's mostly needed when you
allocate dynamically individual objects (which is the case with most
GC'd languages). However, using individually allocated objects is a
performance killer. (In fact, using "objects" at all, ie. class
instances, is a performance killer.)

DOD doesn't require individually allocated objects, as everything is
put into arrays. (And not as in arrays of objects. Arrays of individual
values, which would normally be class member variables.)

Since optimally all the dynamically allocated data is in arrays, and
no "object" refers to any other "object", the need for automatic GC
is significantly lessened.

In contrast, low-level control of what the compiler produces is
significantly more important.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

manual memory management, vs an automatic gc... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-09-23 12:57 -0700
  Re: manual memory management, vs an automatic gc... Juha Nieminen <nospam@thanks.invalid> - 2022-09-26 08:29 +0000
    Re: manual memory management, vs an automatic gc... "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-09-26 17:09 -0700
      Re: manual memory management, vs an automatic gc... Juha Nieminen <nospam@thanks.invalid> - 2022-09-27 06:45 +0000

csiph-web