How to set the compiler to handle thousand loops ? - Java

This is a discussion on How to set the compiler to handle thousand loops ? - Java ; Hi, Hi, I'm using NetBeans IDE 6.1 to develope my application. My application works well when deals with loops of reading 52,000 lines of waveform data. But it fails when reads 104,000 of waveform data. How to set the IDE ...

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 28

How to set the compiler to handle thousand loops ?

  1. Default How to set the compiler to handle thousand loops ?

    Hi,

    Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    application works well when deals with loops of reading 52,000 lines
    of waveform data. But it fails when reads 104,000 of waveform data.
    How to set the IDE to handle multiple loops like this ? I'm using
    FileOutputStream function, while-do, and ByteBuffer function in this
    case. Please advise. Thank you in advance.

  2. Default Re: How to set the compiler to handle thousand loops ?

    On Fri, 31 Oct 2008 01:41:25 -0700 (PDT), tobleron <budhik@yahoo.com>
    wrote, quoted or indirectly quoted someone who said :

    >Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    >application works well when deals with loops of reading 52,000 lines
    >of waveform data. But it fails when reads 104,000 of waveform data.
    >How to set the IDE to handle multiple loops like this ? I'm using
    >FileOutputStream function, while-do, and ByteBuffer function in this
    >case. Please advise. Thank you in advance.


    see http://mindprod.com/applet/fileio.html

    for to generate code for all manner of ways of reading your data.

    You also might consider CSV format.
    see http://mindprod.com/jgloss/csv.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    A vote for McCain is fearful clinging to McSame.
    A vote for Obama is a shot at Obamalot.

  3. Default Re: How to set the compiler to handle thousand loops ?


    tobleron wrote:
    > Hi,
    >
    > Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    > application works well when deals with loops of reading 52,000 lines
    > of waveform data. But it fails when reads 104,000 of waveform data.
    > How to set the IDE to handle multiple loops like this ? I'm using
    > FileOutputStream function, while-do, and ByteBuffer function in this
    > case. Please advise. Thank you in advance.


    Please read http://www.catb.org/~esr/faqs/smart-questions.html

    - Define "it fails".
    - Where is your code?
    - What makes you think an IDE places any restriction on loop size?

    --
    RGB

  4. Default Re: How to set the compiler to handle thousand loops ?

    tobleron wrote:
    >> Hi,
    >> Hi,
    >> I'm using NetBeans IDE 6.1 to develope my application. My
    >> application works well when deals with loops of reading 52,000 lines
    >> of waveform data. But it fails when reads 104,000 of waveform data.
    >> How to set the IDE to handle multiple loops like this ? I'm using
    >> FileOutputStream function, while-do, and ByteBuffer function in this
    >> case. Please advise. Thank you in advance.


    RedGrittyBrick wrote:
    > Please read http://www.catb.org/~esr/faqs/smart-questions.html
    >
    > - Define "it fails".
    > - Where is your code?
    > - What makes you think an IDE places any restriction on loop size?


    Hint to the OP: The IDE has nothing to do with the problem.

    Check out, read thoroughly, and follow the advice of <http://sscce.org/>.

    --
    Lew

  5. Default Re: How to set the compiler to handle thousand loops ?

    On Oct 31, 5:58 pm, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
    wrote:
    > tobleron wrote:
    > > Hi,

    >
    > > Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    > > application works well when deals with loops of reading 52,000 lines
    > > of waveform data. But it fails when reads 104,000 of waveform data.
    > > How to set the IDE to handle multiple loops like this ? I'm using
    > > FileOutputStream function, while-do, and ByteBuffer function in this
    > > case. Please advise. Thank you in advance.

    >
    > Please readhttp://www.catb.org/~esr/faqs/smart-questions.html
    >
    > - Define "it fails".
    > - Where is your code?
    > - What makes you think an IDE places any restriction on loop size?
    >
    > --
    > RGB


    @All,

    Here is the the error code shows by NetBeans IDE :

    Caused by: java.lang.OutOfMemoryError: Java heap space
    at ....

    For mor detail, my code is to generating DICOM file which is contains
    waveform data of ECG record. The waveform data source is a text file
    that contains hundreds or even thousands lines of ECG signal. Each
    line contains 12 ECG channels. So what my code do is :

    - first : opens the text file BufferedReader function.
    - second : uses FileOutputStream function to write the streamed bytes.
    - third : reads line by line (by using scanner and loop function) then
    split each line to get the 12 channels value.
    - forth : switch to little endian encoding to write the channel value
    bytes (DICOM using little endian encoding for the waveform value).

    The third and forth steps are looped from the first line until the end
    line of the text file.

    I said : it fails, because the process is stopped and the IDE shows
    error message above.

    I thought the IDE can not handle thousands times of looping, because
    the code works well in 52,000 lines data, but when I doubled the
    lines, the process is stopped and the error message is occured. And it
    was "out of memory".

    So, I want to know, is there any way to make adjustment in IDE, may be
    for buffer setting, or some thing like that ? I used 512 MB of RAM,
    and I seek another possible ways other than "add more RAMs". Please
    advise.

  6. Default Re: How to set the compiler to handle thousand loops ?

    tobleron wrote:
    > On Oct 31, 5:58 pm, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
    > wrote:
    >> tobleron wrote:
    >>> Hi,
    >>> Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    >>> application works well when deals with loops of reading 52,000 lines
    >>> of waveform data. But it fails when reads 104,000 of waveform data.
    >>> How to set the IDE to handle multiple loops like this ? I'm using
    >>> FileOutputStream function, while-do, and ByteBuffer function in this
    >>> case. Please advise. Thank you in advance.

    >> Please readhttp://www.catb.org/~esr/faqs/smart-questions.html
    >>
    >> - Define "it fails".
    >> - Where is your code?
    >> - What makes you think an IDE places any restriction on loop size?
    >>
    >> --
    >> RGB

    >
    > @All,
    >
    > Here is the the error code shows by NetBeans IDE :
    >
    > Caused by: java.lang.OutOfMemoryError: Java heap space
    > at ....


    You would see the same error even running outside the IDE.

    Just out of curiosity, why aren't you quoting the entire error message?

    OOME means you haven't allocated enough memory for the process, or else you
    are wasting memory in your code (my bet). Allocate more memory or else fix
    the bug.

    > For mor detail, my code is to generating DICOM file which is contains


    For more detail:
    > Check out, read thoroughly, and follow the advice of <http://sscce.org/>.


    Why the heck do you ignore advice, then ask for more help?

    > waveform data of ECG record. The waveform data source is a text file
    > that contains hundreds or even thousands lines of ECG signal. Each
    > line contains 12 ECG channels. So what my code do is :


    SSCCE, please. Description is useless.

    > - first : opens the text file BufferedReader function.
    > - second : uses FileOutputStream function to write the streamed bytes.
    > - third : reads line by line (by using scanner and loop function) then
    > split each line to get the 12 channels value.
    > - forth : switch to little endian encoding to write the channel value
    > bytes (DICOM using little endian encoding for the waveform value).
    >
    > The third and forth steps are looped from the first line until the end
    > line of the text file.


    Gee, if we could only see the code we could tell you where your mistake is.

    > I said : it fails, because the process is stopped and the IDE shows
    > error message above.


    You said too little to let us help.

    > I thought the IDE can not handle thousands times of looping, because


    Your problem has nothing to do with the IDE.

    > the code works well in 52,000 lines data, but when I doubled the
    > lines, the process is stopped and the error message is occured. And it
    > was "out of memory".


    You are not releasing memory after each loop.

    > So, I want to know, is there any way to make adjustment in IDE, may be


    Nope.

    > for buffer setting, or some thing like that ? I used 512 MB of RAM,
    > and I seek another possible ways other than "add more RAMs". Please
    > advise.


    You got advice that you ignored.
    <http://sscce.org/>

    Generally speaking, your code is allocating memory that it never releases.
    Release unused objects and they will be collected, and you won't get the OOME.

    <http://sscce.org/>
    <http://sscce.org/>
    <http://sscce.org/>

    --
    Lew

  7. Default Re: How to set the compiler to handle thousand loops ?

    On Fri, 31 Oct 2008 04:24:01 -0700, tobleron wrote:

    > So, I want to know, is there any way to make adjustment in IDE, may be
    > for buffer setting, or some thing like that ? I used 512 MB of RAM, and
    > I seek another possible ways other than "add more RAMs". Please advise.
    >

    So, if I understand your description, what you're doing is:

    read file into a buffer
    for each line in the buffer
    split into channels
    re-code into DICOM (little endian) format
    append line to output buffer
    end-for
    write output buffer to a file

    If I'm wrong, please describe your logic as an SSCE or in pseudocode.

    Otherwise, why buffer entire files when you appear to be processing the
    data line by line? Read from the file line by line and output each
    converted line as its completed and your memory problems will vanish.


    --
    martin@ | Martin Gregorie
    gregorie. | Es**** UK
    org |

  8. Default Re: How to set the compiler to handle thousand loops ?


    tobleron wrote:
    > On Oct 31, 5:58 pm, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
    > wrote:
    >> tobleron wrote:
    >>> Hi,
    >>> Hi, I'm using NetBeans IDE 6.1 to develope my application. My
    >>> application works well when deals with loops of reading 52,000 lines
    >>> of waveform data. But it fails when reads 104,000 of waveform data.
    >>> How to set the IDE to handle multiple loops like this ? I'm using
    >>> FileOutputStream function, while-do, and ByteBuffer function in this
    >>> case. Please advise. Thank you in advance.

    >> Please readhttp://www.catb.org/~esr/faqs/smart-questions.html
    >>
    >> - Define "it fails".
    >> - Where is your code?
    >> - What makes you think an IDE places any restriction on loop size?
    >>

    >
    > @All,
    >
    > Here is the the error code shows by NetBeans IDE :
    >
    > Caused by: java.lang.OutOfMemoryError: Java heap space
    > at ....
    >
    > For mor detail, my code is to generating DICOM file which is contains
    > waveform data of ECG record. The waveform data source is a text file
    > that contains hundreds or even thousands lines of ECG signal. Each
    > line contains 12 ECG channels. So what my code do is :
    >
    > - first : opens the text file BufferedReader function.
    > - second : uses FileOutputStream function to write the streamed bytes.
    > - third : reads line by line (by using scanner and loop function) then
    > split each line to get the 12 channels value.
    > - forth : switch to little endian encoding to write the channel value
    > bytes (DICOM using little endian encoding for the waveform value).
    >
    > The third and forth steps are looped from the first line until the end
    > line of the text file.
    >
    > I said : it fails, because the process is stopped and the IDE shows
    > error message above.
    >
    > I thought the IDE can not handle thousands times of looping, because
    > the code works well in 52,000 lines data, but when I doubled the
    > lines, the process is stopped and the error message is occured. And it
    > was "out of memory".
    >
    > So, I want to know, is there any way to make adjustment in IDE,


    You don't need to.

    > may be
    > for buffer setting, or some thing like that ? I used 512 MB of RAM,
    > and I seek another possible ways other than "add more RAMs".


    You probably need much LESS RAM if you fix your coding.

    > Please advise.


    See Martin Gregorie's advice. With more or less the *same* *small*
    amount of memory usage you should be able to process 1 line, 1000 lines,
    1000000 lines, 1000000000 lines or almost any number of lines (each
    containing twelve channel values).

    Just make sure your FileOutputStream is being flushed periodically and
    that you are not "packratting" objects
    (http://mindprod.com/jgloss/packratting.html)


    --
    RGB

  9. Default Re: How to set the compiler to handle thousand loops ?

    @All,

    You can download my source code at http://www.artikelilmiah.com/NewECGRecord.zip
    The waveform data can be downloaded at http://www.artikelilmiah.com/12ecgsample2-104000.zip
    and http://www.artikelilmiah.com/12ecgsample2-52000.zip

    Here is the complete error message :

    init:
    deps-jar:
    compile:
    run:
    Nov 1, 2008 11:25:26 AM org.jdesktop.application.LocalStorage getId
    WARNING: unspecified resource Application.id using Main
    Nov 1, 2008 11:25:26 AM org.jdesktop.application.LocalStorage getId
    WARNING: unspecified resource Application.vendorId using
    UnknownApplicationVendor
    Exception in thread "AWT-EventQueue-0" java.lang.Error:
    java.lang.reflect.InvocationTargetException
    at
    org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:
    859)
    at
    org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:
    665)
    at
    org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:
    698)
    at
    javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:
    1995)
    at javax.swing.AbstractButton
    $Handler.actionPerformed(AbstractButton.java:2318)
    at
    javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
    387)
    at
    javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at
    javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:
    236)
    at
    java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:
    272)
    at java.awt.Component.processMouseEvent(Component.java:6041)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:
    3265)
    at java.awt.Component.processEvent(Component.java:5806)
    at java.awt.Container.processEvent(Container.java:2058)
    at java.awt.Component.dispatchEventImpl(Component.java:4413)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Component.dispatchEvent(Component.java:4243)
    at
    java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    at
    java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
    3916)
    at java.awt.Container.dispatchEventImpl(Container.java:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2440)
    at java.awt.Component.dispatchEvent(Component.java:4243)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
    273)
    at
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
    183)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
    173)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:
    121)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:
    662)
    ... 27 more
    Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:3209)
    at java.lang.String.<init>(String.java:216)
    at java.lang.StringBuffer.toString(StringBuffer.java:585)
    at ecgterminal3.NewECGRecord.okGenerate(NewECGRecord.java:
    2429)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:
    662)
    at
    org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:
    698)
    at
    javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:
    1995)
    at javax.swing.AbstractButton
    $Handler.actionPerformed(AbstractButton.java:2318)
    at
    javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
    387)
    at
    javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at
    javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:
    236)
    at
    java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:
    272)
    at java.awt.Component.processMouseEvent(Component.java:6041)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:
    3265)
    at java.awt.Component.processEvent(Component.java:5806)
    at java.awt.Container.processEvent(Container.java:2058)
    at java.awt.Component.dispatchEventImpl(Component.java:4413)
    at java.awt.Container.dispatchEventImpl(Container.java:2116)
    at java.awt.Component.dispatchEvent(Component.java:4243)
    at
    java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    at
    java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:
    3916)
    at java.awt.Container.dispatchEventImpl(Container.java:2102)
    at java.awt.Window.dispatchEventImpl(Window.java:2440)
    at java.awt.Component.dispatchEvent(Component.java:4243)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
    273)
    at
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
    183)
    BUILD SUCCESSFUL (total time: 1 minute 58 seconds)

    So, please help. As I mentioned before, it works well on 52000 lines
    of waveform data (and under), but fails when trying to read 104000
    lines of waveform data.

  10. Default Re: How to set the compiler to handle thousand loops ?

    tobleron wrote:
    > You can download my source code at http://www.artikelilmiah.com/NewECGRecord.zip


    <http://sscce.org/>

    > So, please help. As I mentioned before, it works well on 52000 lines
    > of waveform data (and under), but fails when trying to read 104000
    > lines of waveform data.


    <http://sscce.org/>

    --
    Lew

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast