harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paulex Yang <paulex.y...@gmail.com>
Subject Re: Using APR for Harmony's native link to the OS?
Date Thu, 23 Feb 2006 08:05:39 GMT
Artem Aliev wrote:
> Hello,
> I did some experiments with developing harmony portlib over APR.
> The main problem for me is an APR memory model.
> It is well suitable only for transactions.
> There is no free() memory call. You could destroy only whole memory pool.
> This works well only for short living threads or tasks. This is
> typical for HTTP server, not Java application. (All apr_*_create
> functions require apr_pool_t* as argument)
> I tried to create sub-pool for each object as workaround. This hits
> memory footprint and performance.
> So APR memory model should be extended. For example portlib memory
> pools could be integrated into APR.
Is this what you need? 
I just skimmed over the APR document, seems APR provides two memory 
related modules, one is based on apr_pool_t, the other uses 
apr_allocator_t, they can be linked by set apr_pool_t as owner of 
apr_allocator_t, but I have no idea what it means, anyone can help? 
anyway, the internal memory allocation functions(the one using 
apr_allocator_t) seems OK as a memory model.

> The second problem is ugly "Developing wrappers over wrappers".
> For example, a call stack for read() method will look like following,
> in case we will develop Portlib over APR:
> Java_java_io_FileInputStream_read() calls
> portlib->hyfile_read(portLib...) calls
> apr_file_read(apr_file, ...) calls
> read(....) system calls.
> If we change portlib interface to be apr compatible, call stack could
> be a little bit better:
> Java_java_io_FileInputStream_read(...) calls
> portLib->apr_file_read(portLib->files[fd], ...) calls
> read(...) system calls.
> And definitely we will need to add a lot of new functions into APR.
Agree with you that APR may need many new functions to fully support VM and class library,
as an example, Java NIO supports async socket IO by Selector and SelectableChannel, Harmony
portlib provides native support to the select operation, but I cannot find direct support
from APR(maybe just because I missed it, after all I'm a newbie to APR ;-) , anyway, just
an example). But after all, maybe we don't need to implement everything in APR as well as
portlib, what we should do at first is to specify a reasonable portlib interfaces which is
just fit for the our needs. The current portlib is a pretty good base for discussion I think.

> Thank you,
> Artem Aliev
> Intel Middleware Products Division

Paulex Yang
China Software Development Lab

View raw message