Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > c++ assert in jni code causes core dump

Reply
Thread Tools

c++ assert in jni code causes core dump

 
 
BlueDoze
Guest
Posts: n/a
 
      05-04-2004
Helloo,

I'm developing a library with C++, and the interface of the
application will be with java, JNI will be used.
The problem is that whenever assert() occurs, the whole application
core dumps, Is this the normal behavior, or that's a wrong one.
I know that asserts should not be occured in normal cases, but I don't
like the core dump.

Any thoughts.

Bluedoze
 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      05-04-2004
BlueDoze wrote:

> The problem is that whenever assert() occurs, the whole application
> core dumps, Is this the normal behavior, or that's a wrong one.
> I know that asserts should not be occured in normal cases, but I don't
> like the core dump.


I don't blame you.

I can't comment on whether there's a mechanism for, say, turning assertion
failure into Java exceptions (though I'm sure it'd be possible to hack up
something).

What I want to say is that you shouldn't be tripping assertions /at all/, not
merely "not in normal case". I don't think assertions should be used for
run-time validation, not after develoment is well advanced, and /certainly/ not
in a deployed application.

If you want run-time validation (which is a perfectly reasonably thing to
want), then /code/ run-time validation. With a proper error return or -- more
likely -- a proper exception thrown.

The only reason to trip an assertion in "real" code is a serious programming
error -- a serious, and unrecoverable, bug. In such cases exiting abruptly
with a core dump (or the equivalent on other systems) is the appropriate thing
to do. I mean what /else/ should a program that has detected an
/unrecoverable/ bug do ?

-- chris


 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      05-04-2004
On 4 May 2004 02:13:48 -0700, BlueDoze wrote:
> The problem is that whenever assert() occurs, the whole application
> core dumps, Is this the normal behavior, or that's a wrong one. I
> know that asserts should not be occured in normal cases, but I don't
> like the core dump.


That's normal behaviour for a failed assertion. What do you think
assert() should do insead? And what does this have to do with JNI?

If you don't want a core file, then use ulimit in your command shell
to configure the maximum core file size to 0.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
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
Dump complete java VM state as core dump (not via OS) possible? halfdog Java 12 02-21-2013 06:14 AM
free causes core-dump loudking C Programming 4 01-11-2008 12:01 AM
JNI FindClass(java/lang/string) causes core dump on AIX 5.2 abhijit.dhariya@gmail.com Java 2 03-31-2006 08:00 PM
string ok as public causes core dump as public Jake C++ 1 11-11-2005 01:04 PM
assert(x) and '#define ASSERT(x) assert(x)' Alex Vinokur C Programming 5 11-25-2004 08:48 PM



Advertisments