RFR: 8251850: Simplify ResourceMark constructors using delegation
John Rose
john.r.rose at oracle.com
Thu Aug 20 07:44:38 UTC 2020
On Aug 18, 2020, at 12:49 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
>
> Poorly named and poorly commented variable from before the beginning of the mercurial age,
> so hard to track down the changeset that introduced it to see if that shed some light. Good
> thing we have some institutional memory :)
You rang? The SCCS record looks like this:
1.3 97/08/11 11:39:04 steffen 4 3
+…
+// ResourceArea //////////////////
+
+#ifdef ASSERT
+int ResourceArea::_warned = 0;
+#endif
+
+ResourceArea::ResourceArea() {
+…
That delta (1.3/#4) replaced this code (along with lots of related
code, in a large refactoring of ResourceArea). It is the first
occurrence of the name “warned”:
- char* allocate_bytes(int size) {
- assert(size >= 0, "negative size in allocate_bytes");
-#ifdef ASSERT
- // NB: don't make it a fatal error -- otherwise, if you call certain functions
- // from the debugger, it might report a leak since there might not be a
- // ResourceMark.
- // However, in all other situations, calling allocate_bytes with nesting == 0
- // is a definitive memory leak. -Urs 10/95
- static int warned = 0; // to suppress multiple warnings (e.g. when allocating from the debugger)
- if (nesting < 1 && !warned++) error("memory leak: allocating w/o ResourceMark!");
-#endif
Several months later we find today’s line:
1.41 99/01/28 14:01:01 renes 53 52
+debug_only(int ResourceArea::_warned;) // to suppress multiple warnings
Yes, those little lines are all the repo metadata present (in per-file SCCS records).
There are no checkin comments. Those were the days…
— John
More information about the hotspot-runtime-dev
mailing list