skip searching for mallinfo when mallinfo2 is found

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • tbd
    • Affects Version/s: 22
    • Component/s: hotspot

      mallinfo is used as a fallback when the glibc doesn't implement the newer version of it - mallinfo2.
      But we doing the lookups for the older mallinfo unconditionally at the initialization phase even though we know it will be unused.

      - g_mallinfo = CAST_TO_FN_PTR(mallinfo_func_t, dlsym(RTLD_DEFAULT, "mallinfo"));
         g_mallinfo2 = CAST_TO_FN_PTR(mallinfo2_func_t, dlsym(RTLD_DEFAULT, "mallinfo2"));
      + // mallinfo2 was introduced in glibc 2.33
      + if (g_mallinfo2 == nullptr) {
      + g_mallinfo = CAST_TO_FN_PTR(mallinfo_func_t, dlsym(RTLD_DEFAULT, "mallinfo"));
      + }

            Assignee:
            Ivan Bereziuk
            Reporter:
            Ivan Bereziuk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: