You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ruth Cao (JIRA)" <ji...@apache.org> on 2007/02/08 11:49:06 UTC

[jira] Updated: (HARMONY-1194) [classlib][nio] unexpected "Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[xxx]" messages

     [ https://issues.apache.org/jira/browse/HARMONY-1194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ruth Cao updated HARMONY-1194:
------------------------------

    Attachment: Harmony-1194.diff

May somebody pls try this one?

> [classlib][nio] unexpected "Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[xxx]" messages
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1194
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1194
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vladimir Ivanov
>         Attachments: Harmony-1194.diff
>
>
> The test below report on the 2CPU computers messages like this
> "Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[159703592]"
> Note, on 1 CPU it works fine. I did not detect problem yet so continue to investigate.
> ============================= test.java ===========================
> import java.io.File;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.nio.ByteBuffer;
> import java.nio.channels.FileChannel;
> public class test {
>     public int NUMBER_OF_ITERATIONS = 10000;
>     public int NUMBER_OF_BYTE_BUFFERS = 3;
>     public int bufferSize = 1024;
>     public int numThreads = 15;
>     // Each thread sets PASS/FAIL flag into its corresponding array element
>     public int[] statuses;
>     public static void main(String[] args) {
>         System.exit(new test().test(args));
>     }
>     public int test(String[] params) {
>         // Start 'numThreads' threads each reading from file, inflating/deflating
>         Thread[] t = new Thread[numThreads];
>         statuses = new int[t.length];
>                                 
>         for (int i = 0; i < t.length; i++) {
>             t[i] = new Thread(new ChannelWriteThread(i, this));
>             t[i].start();
>             System.out.println("Thread " + i + " started");
>         }
>                 
>         // wait for all threads to finish
>         for (int i = 0; i < t.length; ++i){
>              try {
>                  t[i].join();
>                  System.out.println("Thread " + i + ": joined() ");
>              } catch (InterruptedException ie){
>                  System.out.println("interruptedException while join() of thread #" + i);
>                  return -1;
>              }
>          }
>          // check status
>          for (int i = 0; i < statuses.length; ++i){
>              if (statuses[i] != 10){
>                  System.out.println("thread #" + i + " returned not PASS status");
>                  return -1;
>              }
>          }
>         System.out.println("OK");
>         return 0;
>     }
> }
> class ChannelWriteThread implements Runnable {
>     public int id;
>     public test base;
>     public ChannelWriteThread(int id, test base) {
>         this.id = id;
>         this.base = base;
>     }
>     public void run() {
>         FileOutputStream fos = null;
>         FileChannel channel = null;
>         try {
>             File file = File.createTempFile("test", null);
>             file.deleteOnExit();
>             fos = new FileOutputStream(file);
>             channel = fos.getChannel();
>         } catch (IOException e) {
>             e.printStackTrace();
>         } 
>         base.statuses[id] = 10;
>         ByteBuffer[] buffer = new ByteBuffer[base.NUMBER_OF_BYTE_BUFFERS];
>         for (int i = 0; i < base.NUMBER_OF_ITERATIONS; ++i) {
>             for(int j = 0; j < base.NUMBER_OF_BYTE_BUFFERS; j++) {
>                 buffer[j] = ByteBuffer.allocate(2 * base.bufferSize); 
>             }
>             buffer[0].flip(); 
>             try {
>                 channel.write(buffer);  
>             } catch (IOException e) {
>                 base.statuses[id] = -1;
>                 System.out.println("Thread " + id + " : IOException while buffer writing");
>             }
>             buffer[0].clear();
>         }
>         try {
>             channel.close();
>             fos.close();
>         } catch (IOException e) {
>             base.statuses[id] = -1;
>             System.out.println("Thread " + id + " : IOException while closing");
>         }
>     }
> }
> ===============================================================
> Output (for 4 CPU comp):
> Y:\site\proj\drl\qe\my>inaries\builds\combined\20060815\Harmony-drlvm_20060815_win_ia32_0000_msvc\bin\java.exe -Dvm.assert_dialog=false -cp . -showversion test
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Aug 15 2006), Windows/ia32/msvc 1310, debug build
> http://incubator.apache.org/harmony
> Thread 0 started
> Thread 1 started
> Thread 2 started
> Thread 3 started
> Thread 4 started
> Thread 5 started
> Thread 6 started
> Thread 7 started
> Thread 8 started
> Thread 9 started
> Thread 10 started
> Thread 11 started
> Thread 12 started
> Thread 13 started
> Thread 14 started
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[187955296]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[161934880]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[175398240]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[168220896]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[161925840]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[172589448]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[190659456]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[200620192]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[171946168]
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[192747808]
> Thread 0: joined()
> Memory Spy! Fixed attempt to free memory that was not allocated PlatformAddress[172558608]
> Thread 1: joined()
> Thread 2: joined()
> Thread 3: joined()
> Thread 4: joined()
> Thread 5: joined()
> Thread 6: joined()
> Thread 7: joined()
> Thread 8: joined()
> Thread 9: joined()
> Thread 10: joined()
> Thread 11: joined()
> Thread 12: joined()
> Thread 13: joined()
> Thread 14: joined()
> OK

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