Runtime?
Moritz Maxeiner via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 24 03:34:02 PDT 2017
On Wednesday, 24 May 2017 at 07:54:04 UTC, Wulfklaue wrote:
> Great ... accidentally pressed send.
>
> So my question was:
>
> Why does even a simple empty empty statement like this,
> compiled with DMD, show under windows a almost 1.7MB memory
> usage?
Because the garbage collector (GC) allocates a sizable chunk of
memory from the operating system at program startup, from which
it then in turn allocates memory for you when you use things like
dynamic closures, `new XYZ`, etc.
>
> void main()
> {
> while(true){}
> }
>
> The same in C/C++ is simply 0.1MB. This is why i asked the
> question if the runtime is somehow responsible?
Yes, it is. It is the price we have to pay for having a GC. If
the overhead bothers you, you might want to compare it with other
garbage collected languages (such as Go).
PS: This might belong in Learn, instead of General.
More information about the Digitalmars-d
mailing list