|
Re: Using APR for Harmony's native link to the OS?: msg#01017java.harmony.devel
Artem Aliev wrote: Hello, You are correct about that. There is no free call. Memory can be either reused by calling apr_pool_clear or freed by calling apr_pool_destroy. Because for any IO system object (file, socket, mutex, etc.) you usually need some additional struct, the standard implementation look like: struct my_struct; my_struct = malloc(...); my_truct->fh = open(...) ... do something with object close(my_truct->fh); free(my_struct); With APR it would look like: struct my_struct; pool = apr_pool_create(...) my_struct = apr_palloc(pool, ...) my_truct->fh = apr_xxx_open(pool, ...) ... do something with object apr_xxx_close(my_truct->fh); apr_pool_destroy(pool); Since each created object has it's own cleanup function when calling apr_pool_destroyed all objects created with that pool will call it's cleanup functions, so there is no need to call the apr_xxx_close. So APR memory model should be extended. For example portlib memory Not needed. For any Java object you are actually always doing what apr_pool does anyhow, meaning that during the object lifecycle you allocate memory and on GC you must free all allocated resources. If there is a need for short lived memory standard malloc/free can be used (of course except for apr_* objects). The second problem is ugly "Developing wrappers over wrappers". Right, but on most systems 'read' is not a system call. If you look at the source code for MSVCRT read, you'll see it's much more complex then APR implementation. Anyhow since APR is portable across majority of platforms, there is no need to have the portlib->hyfile_read thought. Regards, Mladen.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Platform dependent code placement (was: Re: repo layout again), Mark Hindess |
|---|---|
| Next by Date: | Re: local test server (Was: Re: [jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError), George Harley |
| Previous by Thread: | Re: Using APR for Harmony's native link to the OS?, Paulex Yang |
| Next by Thread: | [jira] Closed: (HARMONY-48) Extract x-net component from 'security2' module, Geir Magnusson Jr (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |