On Sat, 24 Sep 2022 09:47:38 GMT, Johan Sjölen <jsjo...@openjdk.org> wrote:
>> src/hotspot/share/memory/allocation.hpp line 219: >> >>> 217: }; >>> 218: >>> 219: class DynCHeapObj { >> >> I tried this and it seems to work: If you make CHeapObj new operators take >> MEMFLAGS f = F, where F is the default value, you could not have this class >> and make outputStream inherit from CHeapObj<mtInternal\> and the new calls >> will override mtInternal. I guess the risk is that you get mtInternal if >> you forget the parameter to new. > > Good idea! I implemented this instead. We can eliminate this problem: "I guess the risk is that you get mtInternal if you forget the parameter to new." We can instead have CHeapObj<mtFoo> that *only* allocates with mtFoo, and CHeapObj<> that *requires* specifying the flag when allocating the memory. (I did something like this for the CHeapAllocator in my prototype for Standard Library usage.) As part of that, we can also have the MEMFLAGS argument (when needed) always be the first argument in the placement list. Very(!) lightly tested: https://github.com/kimbarrett/openjdk-jdk/tree/dynamic-memflags ------------- PR: https://git.openjdk.org/jdk/pull/10412