<AWT Dev> <i18n dev> RFR[12]: 8211393 Memory leak issue on awt_InputMethod.c

Langer, Christoph christoph.langer at sap.com
Mon Oct 8 06:20:39 UTC 2018


+1

> -----Original Message-----
> From: i18n-dev <i18n-dev-bounces at openjdk.java.net> On Behalf Of Ichiroh
> Takiguchi
> Sent: Dienstag, 2. Oktober 2018 18:30
> To: awt-dev at openjdk.java.net; i18n-dev at openjdk.java.net
> Subject: <i18n dev> RFR[12]: 8211393 Memory leak issue on
> awt_InputMethod.c
> 
> Hello.
> Could you review memory leak fix ?
> 
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8211393
> Change: https://cr.openjdk.java.net/~itakiguchi/8211393/webrev.00/
> 
> I'd like to obtain a sponsor for this issue.
> 
> Thanks,
> Ichiroh Takiguchi
> IBM Japan, Ltd.
> 
> On 2018-07-23 21:24, Ichiroh Takiguchi wrote:
> > Hello.
> >
> > I'd like to change target to "JDK12".
> > I'd like to obtain a sponsor for this patch.
> >
> > Thanks,
> > Ichiroh Takiguchi
> > IBM Japan, Ltd.
> >
> > On 2018-06-28 22:13, Ichiroh Takiguchi wrote:
> >> Hello.
> >> In my investigation, this issue only happens on 64 bit build only...
> >>
> >> On 2018-06-28 06:06, Phil Race wrote:
> >>> On 06/27/2018 06:45 AM, Ichiroh Takiguchi wrote:
> >>>> Hello,
> >>>>
> >>>> I should post this mail before starting JDK11 RDP1.
> >>>
> >>> Already too too late for that, but although this looks like a bug -
> >>> and the correct fix -
> >>> the bug has been there forever .. since JDK 1.2  in 1998 !
> >>> That makes it a 20 year old bug, so I don't think we need to treat it
> >>> as urgent
> >>> for JDK 11.
> >>>
> >>> -phil.
> >>>
> >>>>
> >>>> I found memory leak issue on awt_InputMethod.c.
> >>>>
> >>>> See
> src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c.
> >>>> On line 1117, memory area was allocated by malloc(), but free() is
> >>>> missing
> >>>> ===========================================
> >>>>   1099          if (text->feedback != NULL) {
> >>>>   1100              int cnt;
> >>>>   1101              jint *tmpstyle;
> >>>>   1102
> >>>>   1103              style = (*env)->NewIntArray(env, text->length);
> >>>>   1104              if (JNU_IsNull(env, style)) {
> >>>>   1105                  (*env)->ExceptionClear(env);
> >>>>   1106                  THROW_OUT_OF_MEMORY_ERROR();
> >>>>   1107                  goto finally;
> >>>>   1108              }
> >>>>   1109
> >>>>   1110              if (sizeof(XIMFeedback) == sizeof(jint)) {
> >>>>   1111                  /*
> >>>>   1112                   * Optimization to avoid copying the array
> >>>>   1113                   */
> >>>>   1114                  (*env)->SetIntArrayRegion(env, style, 0,
> >>>>   1115                                            text->length,
> >>>> (jint *)text->feedback);
> >>>>   1116              } else {
> >>>>   1117                  tmpstyle  = (jint
> >>>> *)malloc(sizeof(jint)*(text->length));
> >>>>   1118                  if (tmpstyle == (jint *) NULL) {
> >>>>   1119                      THROW_OUT_OF_MEMORY_ERROR();
> >>>>   1120                      goto finally;
> >>>>   1121                  }
> >>>>   1122                  for (cnt = 0; cnt < (int)text->length;
> >>>> cnt++)
> >>>>   1123                          tmpstyle[cnt] = text->feedback[cnt];
> >>>>   1124                  (*env)->SetIntArrayRegion(env, style, 0,
> >>>>   1125                                            text->length,
> >>>> (jint *)tmpstyle);
> >>>>   1126              }
> >>>>   1127          }
> >>>> ===========================================
> >>>> In my investigation, malloc() was called on RHEL7 x86_64 with
> >>>> Japanese Input Method.
> >>>>
> >>>> I'd like to obtain a sponsor for this patch.
> >>>> --------
> >>>> ---
> >>>> old/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c
> >>>> 2018-06-27 02:03:48.134991703 +0900
> >>>> +++
> >>>>
> new/src/java.desktop/aix/native/libawt_xawt/awt/awt_InputMethod.c
> >>>> 2018-06-27 02:03:47.493005265 +0900
> >>>> @@ -1148,6 +1148,7 @@
> >>>>                          tmpstyle[cnt] = text->feedback[cnt];
> >>>>                  (*env)->SetIntArrayRegion(env, style, 0,
> >>>>                                            text->length, (jint
> >>>> *)tmpstyle);
> >>>> +                free(tmpstyle);
> >>>>              }
> >>>>          }
> >>>>      }
> >>>> ---
> >>>>
> old/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
> >>>> 2018-06-27 02:03:49.040972563 +0900
> >>>> +++
> >>>>
> new/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
> >>>> 2018-06-27 02:03:48.391986274 +0900
> >>>> @@ -1123,6 +1123,7 @@
> >>>>                          tmpstyle[cnt] = text->feedback[cnt];
> >>>>                  (*env)->SetIntArrayRegion(env, style, 0,
> >>>>                                            text->length, (jint
> >>>> *)tmpstyle);
> >>>> +                free(tmpstyle);
> >>>>              }
> >>>>          }
> >>>>      }
> >>>> --------
> >>>>
> >>>> Thanks,
> >>>> Ichiroh Takiguchi
> >>>> IBM Japan, Ltd.
> >>>>



More information about the awt-dev mailing list