Typical security issues in C++: why the GC isn't your enemy

areYouSureAboutThat areYouSureAboutThat at gmail.com
Thu Dec 15 08:46:00 UTC 2022


On Monday, 5 December 2022 at 19:57:39 UTC, H. S. Teoh wrote:
>

well.. for while today, the GC was indeed my enemy...
I was trying to exhaust my heap with this:

module test;

void main()
{
   int *p = new int();
   while (p != null) p = new int();
}

but wtf!
.. rattling my brain...
.. why can I do this in C++ and not in D...wtf..
..wtf... god damn it! why won't you work!

Took me a while to work out I needed to do this first:

import core.memory;
GC.disable;

Nonetheless, I'm glad the GC stepped in, and stopped my heap from 
overflowing, and preventing my pc from coming to a complete halt 
;-)



More information about the Digitalmars-d mailing list