public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: abhishek desai <abhi00@gmail.com>
Cc: java@gcc.gnu.org
Subject: Re: Using libgcj with different memory management library.
Date: Mon, 08 Jun 2009 09:09:00 -0000	[thread overview]
Message-ID: <4A2CD546.7030603@redhat.com> (raw)
In-Reply-To: <898285d30906080005n72191f9bn8bf8eb76ff689d18@mail.gmail.com>

abhishek desai wrote:

> 1. As per my understanding libgcj uses boehm garbage collector for
> memory allocations. Are there any allocations in libgcj which are
> not routed to the garbage collector ? specially the parts of the
> library written in C++. From what I understand is that the memory
> allocated with the 'new' operator are routed to the gc .

Not exactly.  If you have a Java class, i.e. one which inherits from
java.lang.Object, then its new uses the GC.

> Is it necessary that the class of object being allocated should be
> derived from the 'object' class for it to be allocated on the gc ?
> or all the allocations with new get routed to gc ?
> http://gcc.gnu.org/onlinedocs/gcj/Object-allocation.html#Object-allocation

Yes, it is.  Of course, you can always overload new in your own classes
to use the Boehm gc, evernif they don't derive from Object.  You'll
have to make sure they're marked correctly, though.

> 2. I have a memory manager which allocates memory from a specific
> memory pool. I want to port boehm gc to use this memory manager for
> its allocations.

I don't understand how this can work.  The gc is a memory manager; how
can it use some other memory manager to do its own work?  You'll have
to explain a little more.

> Can someone give me some pointers as to where I can make the
> necessary modifications ? I can see the gcconfig.h and os_dep.c is
> the file containing the final system memory allocation calls.  Is
> there some other place I need to look at ? Are there any tricky
> issues I need to look at while doing the porting ?

You'll need to the gc just to scan your memory pool, or also manage
it?  Doing the latter will be hard, the former easy.

Andrew.

  reply	other threads:[~2009-06-08  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  7:06 abhishek desai
2009-06-08  9:09 ` Andrew Haley [this message]
2009-06-08  9:43   ` abhishek desai
2009-06-08  9:45     ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2CD546.7030603@redhat.com \
    --to=aph@redhat.com \
    --cc=abhi00@gmail.com \
    --cc=java@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).