Disallow C-Heap allocations from within dynamic C++ initialization?
Thomas Stüfe
thomas.stuefe at gmail.com
Tue Feb 23 15:32:51 UTC 2021
Hi Florian,
On Tue, Feb 23, 2021 at 4:23 PM Florian Weimer <fweimer at redhat.com> wrote:
> * Thomas Stüfe:
>
> > The easiest approach would be to simply disallow early C-Heap
> allocations.
> > So lets say I do this:
> >
> > - move (a part of) NMT initialization very close to the start of
> > Thread::create_vm()
> > - disallow and rewrite all code which does C-Heap allocation earlier
> > (during dynamic C++ initialization)
> >
> > Would that be an acceptable and maintainable stance? Since that would
> mean
> > that we disallow global C++ objects which do C-Heap allocation in their
> > constructors somewhere.
>
> What is a C-Heap allocation in this context?
>
>
Any call going through os::malloc().
> With glibc, initializing a C++ object which has a non-trivial destructor
> can call malloc.
>
> Thanks,
> Florian
>
Thanks, Thomas
More information about the hotspot-dev
mailing list