harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3148) [Classlib][nio] alloc many DirectByteBuffers may cause memory-out-error
Date Tue, 17 Apr 2007 18:44:15 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489505
] 

Mikhail Markov commented on HARMONY-3148:
-----------------------------------------

I've continued playing with Leo's test (with modified ByteBuffer.allocate() -> ByteBuffer.allocateDirect()
calls to utilize DirectBuffers) and managed to get OOM on Harmony. On RI it still passes.

I've increased the allocation chunks for the test to 20 Mb and got OOM for Harmony on 42nd
iteration (i waited too little before - the memory starts swapping so the test goes very slow
after several initial iterations):
Exception in thread "main" java.lang.OutOfMemoryError: Insufficient memory available.
        at org.apache.harmony.luni.platform.OSMemory.malloc(Native Method)
        at org.apache.harmony.luni.platform.PlatformAddressFactory.alloc(PlatformAddressFactory.java:65)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:67)
        at java.nio.BufferFactory.newDirectByteBuffer(BufferFactory.java:95)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:69)
        at Test.main(Test.java:10)

I've applied Leo's patch with 1 modification (as pointed by Win API help):
added 'stat.dwLength = sizeof (stat);' call after 'MEMORYSTATUSEX stat;' line in OSResourcesMonitorWin32.c
and unfortunately it does not fix the problem on WinXP - i still get OOM on 42nd iteration
although GC is invoked (as shown when specify -verbose:gc option) :-(.

> [Classlib][nio] alloc many DirectByteBuffers may cause memory-out-error
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3148
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3148
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Jimmy, Jing Lv
>         Assigned To: Tim Ellison
>         Attachments: patch-3148.zip
>
>
> Hi,
>      As discussed on mailing-list, DirectByteBuffer uses native memory which is out of
GC-control, alloc many DirectByteBuffer may cause memory-out-error if they are not GCed, even
they can be GCed at that time. 
>      This happens in Harmony but not in RI. This should be a bug of Harmony.
>      Note: other native memory users, e.g., java.util.zip.Deflater, may cause this problem
as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message