Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JNI - Garbage collector freeze ?

Reply
Thread Tools

JNI - Garbage collector freeze ?

 
 
julien
Guest
Posts: n/a
 
      07-25-2008
Hi,

There is my problem.

First part : I have a java programme that makes some operation, create
a list, ..;
Second part : I have unrealIRC
I need to make a unrealIRCD module that talk to the java program. This
is the plan.

So to do this, i have make a plugin, that instanciate JVM via JNI and
create an instance of my java class and call a method < String
makeOperation(String param) >

Problem is : in java code i have a System.gc() call. When this code is
execute, unrealIRCD freeze. I have no stack trace, no GC log, nothing,
just freeze. Garbage collector seems to wait something ? After that i
have test to call System.gc() in the class constructor and it works..

If i comment the line in my makeOperation function, its works for few
operations and freeze, i think, when the garbage collector is launched
by the JVM.

I have not a good knowledge about garbage collector. If someone have
an idea about this freeze, please help me
Thanks
 
Reply With Quote
 
 
 
 
jlp
Guest
Posts: n/a
 
      07-25-2008
julien a écrit :
> Hi,
>
> There is my problem.
>
> First part : I have a java programme that makes some operation, create
> a list, ..;
> Second part : I have unrealIRC
> I need to make a unrealIRCD module that talk to the java program. This
> is the plan.
>
> So to do this, i have make a plugin, that instanciate JVM via JNI and
> create an instance of my java class and call a method < String
> makeOperation(String param) >
>
> Problem is : in java code i have a System.gc() call. When this code is
> execute, unrealIRCD freeze. I have no stack trace, no GC log, nothing,
> just freeze. Garbage collector seems to wait something ? After that i
> have test to call System.gc() in the class constructor and it works..
>
> If i comment the line in my makeOperation function, its works for few
> operations and freeze, i think, when the garbage collector is launched
> by the JVM.
>
> I have not a good knowledge about garbage collector. If someone have
> an idea about this freeze, please help me
> Thanks

I don't know what is your problem, but it is a bad idea to use
system.gc() in your code. Let the GC do that...
 
Reply With Quote
 
 
 
 
Hendrik Maryns
Guest
Posts: n/a
 
      07-25-2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

julien schreef:
| Hi,
|
| There is my problem.
|
| First part : I have a java programme that makes some operation, create
| a list, ..;
| Second part : I have unrealIRC
| I need to make a unrealIRCD module that talk to the java program. This
| is the plan.
|
| So to do this, i have make a plugin, that instanciate JVM via JNI and
| create an instance of my java class and call a method < String
| makeOperation(String param) >
|
| Problem is : in java code i have a System.gc() call. When this code is
| execute, unrealIRCD freeze. I have no stack trace, no GC log, nothing,
| just freeze. Garbage collector seems to wait something ? After that i
| have test to call System.gc() in the class constructor and it works..
|
| If i comment the line in my makeOperation function, its works for few
| operations and freeze, i think, when the garbage collector is launched
| by the JVM.
|
| I have not a good knowledge about garbage collector. If someone have
| an idea about this freeze, please help me

Seems like the gc wants to clear some objects which are still needed on
the C side. Carefully check.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkiJs+wACgkQBGFP0CTku6PGUwCgkBtjCfEiVp lLrkeraNUlBITX
CbMAnju1p3VIqGTMIbh86+/yHin9o60T
=d96G
-----END PGP SIGNATURE-----
 
Reply With Quote
 
julien
Guest
Posts: n/a
 
      07-25-2008
> jlp
Thanks for the comment. I know that used System.gc() is currently a
bad idea. I have just used that to improve that was the GC the source
of my problem. In fact the GC is not the problem, its me

> Hendrik

Thanks too. I will try to check and recheck my C jni object and add
NewLocalRef, newGlobalRef etc. There is a way to know that var the GC
wait for cleaning ?

Regards,

 
Reply With Quote
 
Hendrik Maryns
Guest
Posts: n/a
 
      07-25-2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

julien schreef:
|> jlp
| Thanks for the comment. I know that used System.gc() is currently a
| bad idea. I have just used that to improve that was the GC the source
| of my problem. In fact the GC is not the problem, its me
|
|> Hendrik
| Thanks too. I will try to check and recheck my C jni object and add
| NewLocalRef, newGlobalRef etc. There is a way to know that var the GC
| wait for cleaning ?

I’m sorry, I don’t understand you. Ask someone to review your English.
~ Or try in French, and I’ll translate.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkiJvjQACgkQBGFP0CTku6MD+ACcCZV64+QjkP yFYwhrvwtaotzk
hEoAn0o+JZuqQe/w3xx7tPQB0BPJzFhg
=/cCu
-----END PGP SIGNATURE-----
 
Reply With Quote
 
julien
Guest
Posts: n/a
 
      07-25-2008
sorry....

Just want to know if a method exists to find what object in my C code
the GC wants to clear without success.

---

Désolé,
Je voulais juste savoir si une méthode existe afin de savoir quel(s)
objet(s) le garbage collector essaye de supprimer sans y arriver.

Thanks.
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      07-25-2008
On Fri, 25 Jul 2008, julien wrote:

> sorry....
>
> Just want to know if a method exists to find what object in my C code
> the GC wants to clear without success.


I kind of doubt that's what the problem is. The GC will never try to
delete objects on the C side, only the java side.

What might be happening is that the C side is starting a critical section,
during which GC cannot run, and the java side is out of memory, so it's
waiting for the C side to end the critical section. I think the OP should
modify his JVM startup code to add -Xcheck:jni to the JVM parameters, and
see if that catches any JNI mistakes,

If that doesn't work, he should add a bunch of GC logging flags, and see
if he can make sense of the output.

tom

--
No noon today. Noon tomorrow. There's always a noon tomorrow.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JNI problem with Garbage Collector ? bart59 Java 0 06-17-2004 07:34 AM
OutOfMemoryException Error: Garbage Collector doesn't release memory to OS Pyramis ASP .Net 0 01-25-2004 04:37 PM
DVD Verdict reviews: ALIEN: COLLECTOR'S EDITION, ALIEN3: COLLECTOR'S EDITION, and more! DVD Verdict DVD Video 0 12-15-2003 10:05 AM
Garbage collector problem Colt Java 9 11-18-2003 01:15 PM
Garbage Collector Debugging Rob Tillie ASP .Net 11 08-18-2003 10:39 PM



Advertisments