Java Object allocation from C++ and references?
Ben Martin
monkeyiq@users.sourceforge.net
Wed Feb 4 05:06:00 GMT 2004
On Wed, 2004年02月04日 at 00:40, Andrew Haley wrote:
> Ben Martin writes:
> > is it correct to assume that if one is to use C++ code and create an
> > object implemented in Java code, for example, java::lang::String, then
> > the C++ code creating the new String* does not call delete?
>> That's right.
>> > I have rolled rpms for jakarta-lucene using gcj from Fedora
> > development and using C++ smart pointers to manage
> > java::lang::string objects seems to work but when I use a C++ smart
> > pointer on one of the Lucene java objects the program crashes on
> > the delete of that object.
>> You mustn't do that. Let the garbage collector do the job.
Upon reflection, I think I may have been using reference counting for
too long for memory management. I'll assume that the GC will collect all
Java objects that are made irrespective of if they are constructed from
Java or C++ using CNI.
--
Blogtackular http://advogato.org/person/monkeyiq/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040204/69890f92/attachment.sig>
More information about the Java
mailing list