public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/60282] New: memory leak - Double from string, _Jv_Balloc
@ 2014-02-20 8:23 antoine.dymond at gmail dot com
0 siblings, 0 replies; only message in thread
From: antoine.dymond at gmail dot com @ 2014-02-20 8:23 UTC (permalink / raw)
To: java-prs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60282
Bug ID: 60282
Summary: memory leak - Double from string, _Jv_Balloc
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcj
Assignee: unassigned at gcc dot gnu.org
Reporter: antoine.dymond at gmail dot com
I believe there is memory leak when creating a Double from a string. For
example
double value = (new Double("3.14")).doubleValue();
Valgrind output:
== 56 bytes in 1 blocks are definitely lost in loss record 17 of 31
== at 0x4C2A2DB: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
== by 0x6DE98D1: _Jv_Balloc (in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x6DEA378: _Jv_d2b (in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x6DE4BDB: _Jv_dtoa_r (in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x6DE5F0F: _Jv_dtoa (in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x65CBF9D: java::lang::String* java::lang::VMDouble::toString(double,
bool) (in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x6926404: java::lang::String* java::lang::Double::toString(double)
(in /usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x6926418: java::lang::AbstractStringBuffer*
java::lang::AbstractStringBuffer::append(double) (in
/usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
== by 0x69264D8: java::lang::StringBuilder*
java::lang::StringBuilder::append(double) (in
/usr/lib/x86_64-linux-gnu/libgcj.so.14.0.0)
Reconstruct info
-----------------
$ more double_from_str.java
public class double_from_str {
public static void convert(){
double value = (new Double("3.14")).doubleValue();
System.out.printf("pi = " + value + "\n");
}
}
$ more main.cpp
#include <stdio.h>
#include <gcj/cni.h>
#include <java/lang/System.h>
#include <java/io/PrintStream.h>
#include <java/lang/Throwable.h>
#include "double_from_str.h"
int main(int argc, char *argv[])
{
using namespace java::lang;
try
{
JvCreateJavaVM(NULL);
JvAttachCurrentThread(NULL, NULL);
double_from_str().convert();
JvDetachCurrentThread();
return 0;
}
catch (Throwable *t)
{
printf("Unhandled Java exception\n");
t->printStackTrace();
return 1;
}
}
$ make -B
gcj -fPIC -c double_from_str.java
gcj -C double_from_str.java
gcjh double_from_str.class
gcj -g -lstdc++ double_from_str.o main.cpp -o main.o
cc1plus: warning: command line option
‘-fbootclasspath=./:/usr/share/java/libgcj-4.8.jar’ is valid for Java but not
for C++ [enabled by default]
$ valgrind --leak-check=yes ./main.o
...
$ apt-cache show valgrind
...
Architecture: amd64
Version: 1:3.8.1-4ubuntu1
...
>From java-prs-return-11636-listarch-java-prs=gcc.gnu.org@gcc.gnu.org Thu Feb 20 08:43:37 2014
Return-Path: <java-prs-return-11636-listarch-java-prs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-java-prs@gcc.gnu.org
Received: (qmail 27278 invoked by alias); 20 Feb 2014 08:43:37 -0000
Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <java-prs.gcc.gnu.org>
List-Subscribe: <mailto:java-prs-subscribe@gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/java-prs/>
List-Post: <mailto:java-prs@gcc.gnu.org>
List-Help: <mailto:java-prs-help@gcc.gnu.org>, <http://gcc.gnu.org/ml/#faqs>
Sender: java-prs-owner@gcc.gnu.org
Delivered-To: mailing list java-prs@gcc.gnu.org
Received: (qmail 27223 invoked by uid 55); 20 Feb 2014 08:43:37 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/60261] [4.9 Regression] Weird java install with
--enable-version-specific-runtime-libs
Date: Thu, 20 Feb 2014 08:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: java
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60261-8172-0VKhvVKF3L@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60261-8172@http.gcc.gnu.org/bugzilla/>
References: <bug-60261-8172@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-q1/txt/msg00013.txt.bz2
Content-length: 650
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`261
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Feb 20 08:43:04 2014
New Revision: 207936
URL: http://gcc.gnu.org/viewcvs?rev 7936&root=gcc&view=rev
Log:
2014-02-20 Richard Biener <rguenther@suse.de>
PR libjava/60261
* configure.ac (dbexecdir): Remove redundant multilib addition.
* Makefile.am (gcc_version): Export.
* configure: Regenerate.
* Makefile.in: Likewise.
Modified:
trunk/libjava/ChangeLog
trunk/libjava/Makefile.am
trunk/libjava/Makefile.in
trunk/libjava/configure
trunk/libjava/configure.ac
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-20 8:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20 8:23 [Bug libgcj/60282] New: memory leak - Double from string, _Jv_Balloc antoine.dymond at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).