Specific question about an OutOfMemoryError.... with code!

i have the need to move tons of small chunks of byte[] data. We're talking 100-450 Million chunks of 750-2000 bytes of data.
I am trying to streamline some of my algorithms. Because of the checks and edits in place I need to use a LinkedList to hold these in until they are rewritten to disk.
The LinkedList generally holds 1 or 2 of these chunks at a time before passing it on to be written to disk.
Anyways, i was trying to gauge what kind of time is consumed in this process alone. I constructed the following FOR loop:
               LinkedList ll = new LinkedList();
               byte data[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX".getBytes(); //about 700 bytes of data
               byte claimNew[];
               for(int i=0;i<10000000;i++){
                    ll.add(data);
                    claimNew = (byte[])ll.get(0);
                    if(i%100000==0){
                         System.out.println("Processed: " + i);
               }i wanted to run it and increase the number of iterations to see approximately how much time is consumed in this process. NOTE: I know this isn't a very effificent
way to get this information, but it's fast and easily toyed with. I'm not writing a thesis, i just wanted some ballpark ideas.
Anyways, when this loop runs to about 2.7 million it dies with an OutOfMemoryError. I used only the default heap settings. However, this got me curious:
1-What is filling up the heap? is it the space allocated for the byte buffer in the class cast?
2-Shouldn't the byte buffer be marked for the garbage collector once the for loop reaches the end of a certain iteration? Shouldn't that free up heap space?
I am curious about the answer, it seems like this error shouldn't have happened in the first place.
I appreciate any info!
NEVERMIND! I'm a total dork. i didn't notice that i never put that little part in to ... ahem ... REMOVE the data chunk once i've read it from the LinkedList! SORRY!
Edited by: pnandrus on Mar 11, 2010 9:33 AM

Now however you do have the advantage now of knowing roughly how many your can process at once without running out of memory.

Similar Messages

  • Question about infoset query with code

    Hi experts.
    I always appreciate your help. Today, I have some problem. I made infoset query using SQ01 and got some data. Those data include WBS no but some of them didn't. So I tried to put some code into the infoset query that any data has not WBS has some value, for example 'X', in WBS no field.
    I needed to know what field or table I should control to display value 'X' in WBS no field in case that WBS field has no value.
    I tried to put code at "END-OF-SELECTION(before display)" and control %dtab. But I met error message there is no such table %dtab. So, I define %dtab then during runtime, I also met error message %dtab has already been defiend.
    How can I do? Is it impossible thing?? I'm wating for your answer.
    regards.

    Hi, if you just want to fill the field if it is blank, you can do this in the Record Processing Section.
    I'm not familar with the WBS number, so for this example, I will fill the BISMT in MARA during the "Recording Processing" Section.
    if mara-bismt is initial.
    mara-bismt = 'X'.
    endif.
    Regards,
    Rich Heilman

  • A question about a method with generic bounded type parameter

    Hello everybody,
    Sorry, if I ask a question which seems basic, but
    I'm new to generic types. My problem is about a method
    with a bounded type parameter. Consider the following
    situation:
    abstract class A{     }
    class B extends A{     }
    abstract class C
         public abstract <T extends A>  T  someMethod();
    public class Test extends C
         public <T extends A>  T  someMethod()
              return new B();
    }What I want to do inside the method someMethod in the class Test, is to
    return an instance of the class B.
    Normally, I'm supposed to be able to do that, because an instance of
    B is also an instance of A (because B extends A).
    However I cannot compile this program, and here is the error message:
    Test.java:16: incompatible types
    found   : B
    required: T
                    return new B();
                           ^
    1 errorany idea?
    many thanks,

    Hello again,
    First of all, thank you very much for all the answers. After I posted the comment, I worked on the program
    and I understood that in fact, as spoon_ says the only returned value can be null.
    I'm agree that I asked you a very strange (and a bit stupid) question. Actually, during recent months,
    I have been working with cryptography API Core in Java. I understood that there are classes and
    interfaces for defining keys and key factories specification, such as KeySpec (interface) and
    KeyFactorySpi (abstract class). I wanted to have some experience with these classes in order to
    understand them better. So I created a class implementing the interface KeySpec, following by a
    corresponding Key subclass (with some XOR algorithm that I defined myself) and everything was
    compiled (JDK 1.6) and worked perfectly. Except that, when I wanted to implement a factory spi
    for my classes, I saw for the first time this strange method header:
    protected abstract <T extends KeySpec> T engineGetKeySpec
    (Key key, Class<T> keySpec) throws InvalidKeySpecExceptionThat's why yesterday, I gave you a similar example with the classes A, B, ...
    in order to not to open a complicated security discussion but just to explain the ambiguous
    part for me, that is, the use of T generic parameter.
    The abstract class KeyFactorySpi was defined by Sun Microsystem, in order to give to security
    providers, the possibility to implement cryptography services and algorithms according to a given
    RFC (or whatever technical document). The methods in this class are invoked inside the
    KeyFactory class (If you have installed the JDK sources provided by Sun, You can
    verify this, by looking the source code of the KeyFactory class.) So here the T parameter is a
    key specification, that is, a class that implements the interface KeySpec and this class is often
    defined by the provider and not Sun.
    stefan.schulz wrote:
    >
    If you define the method to return some bound T that extends A, you cannot
    return a B, because T would be declared externally at invocation time.
    The definition of T as is does not make sense at all.>
    He is absolutely right about that, but the problem is, as I said, here we are
    talking about the implementation and not the invocation. The implementation is done
    by the provider whereas the invocation is done by Sun in the class KeyFactory.
    So there are completely separated.
    Therefore I wonder, how a provider can finally impelment this method??
    Besides, dannyyates wrote
    >
    Find whoever wrote the signature and shoot them. Then rewrite their code.
    Actually, before you shoot them, ask them what they were trying to achieve that
    is different from my first suggestion!
    >
    As I said, I didn't choose this method header and I'm completely agree
    with your suggestion, the following method header will do the job very well
    protected abstract KeySpec engineGetKeySpec (Key key, KeySpec key_spec)
    throws InvalidKeySpecException and personally I don't see any interest in using a generic bounded parameter T
    in this method header definition.
    Once agin, thanks a lot for the answers.

  • Specific questions about a RAM upgrade to 4GB on my MBP

    I have a MBP model MA895LL/A. Currently populated with the original memory (2GB)
    Recent clean install of Snow Leopard, with all current updates.
    Specific questions:
    What memory does Apple use in their laptops? Does it really matter if you get the same manufacturer for complete compatibility?
    Do timings matter? Will faster timing improve performance slightly, or is it a waste of money to go for the faster stuff on my specific model (Intel Core 2 Duo T7500)
    Best to populate with 2 sticks X 2?
    Finally, how about manufacturers? Anyone have any positive experiences with specific manufacturers, or, horror stories they can share?
    I guess I just want to buy the best memory for my MBP. I build my own PCs, but I'm not sure if the Mac is a little more picky, RAM wise. Cost isn't really a factor. I'm willing to spend a little more, and buy the right stuff, and only do it once, without the hassle of sending it back, etc.
    Any advice would be great. I know its possible this question has been answered many times before. I guess I don't know where to look...

    Uh, yes, this is asked just about every day, like here:
    http://discussions.apple.com/thread.jspa?threadID=2154109&tstart=0
    Using the "Search Category" box in the upper right works.
    To answer your questions, since you likely have the 2 slots filled with 1GB DIMMs, you need to get a pair of 2GB to max the RAM. I guess you could use 1 OEM stick and one 2GB stick for 3GB total, but I would just go for 4GB. If you are under warranty, save the original RAM, as Apple seems to dislike seeing any 3rd party RAM no matter what. Put the OEM RAM back in if you need warranty work.
    I've seen several brands OEM, a lot of Hynix and Samsung, but it is probably all well tested to Apple spec. Otherwise, brands mean nothing, but see the above linked thread. I prefer to go with the exact spec'd RAM myself. I believe "faster" RAM does not run any faster. Vendors mentioned in the linked thread all have selector aids to find the exact RAM for your model.

  • Question about Logon ticket with user mapping at BI-JAVA environment

    We're implementing BI 7.0 including BI Java and SAP EP for end user
    access.
    I have two question about SSO method when we're using BI Java.
    I know we can simply configure SSO logon ticket with BI-Java(EP
    included) and BI-ABAP through BI template installer and we already
    succeeded in that case.
    But the problem is we want to change it to user mapping SSO method for
    some our internal reason.
    After we configure user mapping SSO, we've got SSO failed error when we
    call BI-Java stuff like BEx Web Application iView.
    After many testing implemented, we found SSO Logon ticket with user
    mapping (using SAP reference system). It seems working now.
    But our question is "Is it no problem when we use SSO logon ticket with
    user mapping?" Is there any restriction or issue?
    One more question is we can ONLY use user base mapping when reference
    system used. How can we assign BI-ABAP users to EP Group?

    Using an SAP Reference system is allright. But if the reason u r going for this is because of different usernames in EP and BI, why dont you go for user mapping.
    Anyways, on restriction of reference syetms is that you can have ONLY ONE reference system defined in portal. In you case you can only have the BI system defined.
    Hope this helps!!

  • Questions about PDF exporting with InDe CS5.5

    Hey all,
    A couple questions about exporting to PDF from the latest version of InDe.
    First, I have noticed that it seems to take a lot longer to get to a PDF. Any suggestions for how to speed up the process? It took 8 minutes or so to generate a low-res PDF (for print) of a 24pp document with a few placed images and vector graphics. Wow, that's a long time to wait, especially for a proof.
    Second, the background task... if I get it going on making that 8-minute PDF and then work some more on the document, what exactly is in the PDF? Usually I save before making a PDF or printing. So, is the last version saved what will be in the PDF?
    (As an aside, this ability to work on the doc while generating a PDF seems kind of weird. Generally one makes a PDF for proofing, or even for printing, when all the changes have been made and everything is "final". So, I see no benefit to being able to work on my document while it's making a PDF, as I'm probably finished making revisions for the time being. I have to say that I kind of like the progress bar you get when you make an interactive PDF, as you know you can't work on the document when that's on the screen... )
    Thanks as always.

    First, I have noticed that it seems to take a lot longer to get to a PDF. Any suggestions for how to speed up the process? It took 8 minutes or so to generate a low-res PDF (for print) of a 24pp document with a few placed images and vector graphics. Wow, that's a long time to wait, especially for a proof.
    Yes, this is abnormally long (and too long), something is wrong. What's the full version of InDesign you are running, as reported by holding down Cmd or Control and selecting About InDesign?
    Second, the background task... if I get it going on making that 8-minute PDF and then work some more on the document, what exactly is in the PDF? Usually I save before making a PDF or printing. So, is the last version saved what will be in the PDF?
    Saving is not related. InDesign makes a database snapshot of your document the moment you begin the PDF export, and makes the export relative to that snapshot, regardless of edits you continue to make during the export process, and regardless of saving. Of course saving first is a good idea, for several reasons, not the least of which it sounds like something's fairly seriously wrong with your document or your InDesign installation.
    We recommend you trash your preferences and export your document to IDML and see if either of those things changes this 8-minute behavior...err, assuming you're running 7.5.2.318.
    (As an aside, this ability to work on the doc while generating a PDF seems kind of weird. Generally one makes a PDF for proofing, or even for printing, when all the changes have been made and everything is "final". So, I see no benefit to being able to work on my document while it's making a PDF, as I'm probably finished making revisions for the time being. I have to say that I kind of like the progress bar you get when you make an interactive PDF, as you know you can't work on the document when that's on the screen... )
    Yeah, I think the primary benefit is if you are likely to work on 2 or more files in parallel, so you can finish A and export A and then switch to B. If you'd like a dialog box to pop up when export is done, check out my exportPop script from this post: ANN: automatic dialog after background export (exportPop.jsx.

  • Questions about supporting TLF with Halo components in Flex 4.1

    We recently decided to upgrade to the Flex 4.1 SDK after a year or so at 3.2.  We have been asked to not use the new SPARK components yet because our products would then have a mistmatch of Halo and Spark components in the UI.  We have built support for our Halo components to display html through the ".htmlText" property for the Text components.  For example, we can display strings such as "<p>Choose <b>one</b> option:</p>".  With the upgrade to Flex 4.1 a couple of questions about supporting bi-directional text have come up.  My understanding is that in order to support bi-directional text we need to use the Text Layout Framework.  Does anyone have a suggestion on how we can utilize the TLF with the Halo components in Flex 4.1?    Can we still use the ".htmlText" property somehow or is there a new property that understands the TextFormat markup?  We would love to still be able to use the limited html tags that are supported for the "htmlText" property.  Is there an option where that syntax is still understood?
    Thanks in advance!
    David

    The halo components use TextField, and the spark components use TLF. Both sets have support for some html markup to import and export text. To use bidi text, you have to use TLF; TextField won't work properly.
    It is possible to use TLF to build your own components, and this can work well particularly for applications with specialized needs. But if you need bidi support for advanced components like DataGrid and List, then you should use the spark components.
    Thanks!
    - robin

  • Very specific question about iOS 7 and podcasts

    I have a very specific question regarding the playback of podasts under iOS 7.
    Right now, I've still got iOS 5.1.1 (iPhone 4S).
    What I would like to have is a way to play an episode from a podcast that I have not yet finished, and when I double-click the ear-bud's middle button, then I would like to jump (skip) to the episode in the list, even if that episode is from a different podcast.
    Right now, under iOS 5.1.1, I achieved that by creating a smart playlist in iTunes that collects all the episodes from all podcasts with a play count == 0.
    This smart playlist is mirrored to the iPhone.
    It works very well.
    It seems to me that something like that is not possible under iOS 6, so I skipped that.
    My question now is whether I can acheive this under iOS 7.
    I would be most grateful if some kind soul could shed some light on that for me.
    Best,
    Gabriel.

    Hi Larry,
    Thanks very much for posting a reply.
    I do absolutely intend to print a test copy first - but thanks to your advice at least know the spine is going to be ok!
    I didn't realize that method would give me a nice landscape image of the unbound cover - I'd mistakenly remembered that it gave only one page at a time for front and back.
    Thanks for helping out.
    Best,
    Marco

  • A few questions about using PS3 with 27" iMac display...

    Hey people, I had a few questions about how I could possibly get my ps3 connected to the iMac's 27" screen. First of all, could you guys list some adapters that would be able to convert the HDMI to Mini displayport? That would be great. The only one I know of is that Dr. Bott Digital Video link.
    Okay secondly, I was wondering if I do get the the ps3 connected with the iMac's display with an adapter to convert HDMI to mini DisplayPort, would it be in HD? Would I be able to play ps3 games or watch blu-ray movies in 1080p HD format?
    Thanks!

    Welcome to the Apple Discussions!
    This has been asked a number of times here since the intro of the 27" iMac. The answer is very expensive US$149 or more converters and sometimes even more expensive to maintain the resolutions that you seek.
    http://lowendmac.com/ed/bashur/09db/dvi-to-mini-displayport.html
    Dah•veed

  • Question about 360 movieclip with cursor action

    Hello Flash Forum
    We have a question about a 360 flash / movieclip which comes
    to a halt or jumps to whereever the cursor is moved horizontally
    while any vertical movements is ignored. We are having difficulties
    to implement this and would like to ask whether someone can point
    us into the right direction in Flash 8 - read somewhere that this
    is extremely easy in Flash 8 but we cannot find out how!?
    An example would be:
    http://www.kswiss.com/cgi-bin/kswiss/store/product_detail.html?mv_arg=x&pid=01190:177
    and then chosing 'Go 360'
    Thank you for any assistance and/or direction.
    Alex

    Alex, took a look at your sample - looks to me like
    start_drag and stop_drag on mouse_over. Hope this helps. ash

  • Question About Internet Connection With A Specific Plan

    To access the internet/email/ichat/etc. with an iPhone, is it required to have the privilege of accessing the internet on your current AT&T plan? Or is the iPhone capable of connecting to the net as itself without any special activation privileges that are noted on my sim card/AT&T plan?
    Any accurate help is appreciated (This will determine whether I purchase an iPhone or not. I'd prefer to buy it with no surprises :P )

    at&t's unlimited data plan for the iPhone costs $20/mo - which is truly unlimited for when accessing the internet via at&t's cellular or EDGE network, and includes 200 SMS. This is required when activating an iPhone and is over and above your chosen calling plan.
    The iPhone is also capable of accessing the internet via wi-fi. When wi-fi access is on, the iPhone will automatically connect to an available wi-fi network that you have access to, and have previously connected to before - which is saved on the iPhone. When leaving the range of an available wi-fi network you have access to, the iPhone will automatically switch to EDGE. The switch between EDGE access and an available wi-fi network you have access to - when within range of the wi-fi network, is automatic and seamless.
    All visual voicemail is downloaded to the iPhone via at&t's EDGE network only.
    Long story short, the iPhone's unlimited data plan is required when activating an iPhone, and something you wouldn't want to be without.

  • Question about Java SE Source Code

    I was wondering, what is Java SE written in? Can't be Java right? Since thats like the chicken and the egg. Can't write in Java unless you have a platform to interpret Java code into byte code, but if the platform is written in Java... what is interpreting the platform? The platform can't interpret itself right?
    Little confused about it ^, I didn't post in the thread about open source Java since everyones just fighting on there about how old or new the news is. To tell ya the truth, I heard about it yesterday but didn't expect it so soon. Its nice that its here, its now fully Linux friendly. :D
    I might download the code and take a look at it if its written in Java.

    I was wondering, what is Java SE written in? Can't be
    Java right? Since thats like the chicken and the egg.
    Can't write in Java unless you have a platform to
    interpret Java code into byte code, but if the
    platform is written in Java... what is interpreting
    the platform? The platform can't interpret itself
    right?
    So you write the 0.0.1 compiler and runtime in something else.
    Using that you create and compile a Java version that you call 0.0.2.
    You now have a compiler written in Java that can compile Java.
    The runtime is a bit more complex as it needs some platform specific bootstrapping code, but most of that can be written in Java as well.
    And that's no theory, it's what actually happens (and not just with Java).
    Not everything is Java, but a good chunk certainly is (or can be).

  • A Question about Windows games with boot camp and system requirements

    I don't plan to play many games on my Mac, but after seeing what can be done with it, I've been entertaining the idea of picking up a Windows game or 2 to play in Boot Camp (considering picking up a XP PRO with SP2 for this).
    My question is about the listed systed system requirements and how they might apply to my Mac Pro. I have a dual 2.26.
    As a specific example, I was looking at the game Fallout 3. The box lists a 2.4ghz processor required but I've read on this forum about people running it great with less on their Mac.
    So I was wondering what I would need to consider when looking at those requirements or if games in that range do indeed run well...

    Thanks Kap, you're always helpful.
    That's exactly what I was wondering. How the requirement on the box applied to having an 8 core at a lower clock speed.
    I was looking at XP home at amazon and newegg, but haven't been able to tell if they are 64 or 32 (unless that means just install that version from the disc).
    It's nothing pressing, just something I was entertaining for now.

  • Question about using RE1000 with EA6500

    I have an EA6500 route but having problem getting wireless signal to one room in my house.  As a result, I am thinking about buying RE1000.
    If I buy this unit, will I need to connect to a different network when using wireless devices in the room near the extender.
    Or will both the extender and router operate as a single wireless network name?  If they both operate under a single wireless name, how will I know the extender is connecting and working.
    Please let me know.  Thanks.

    atomarchio wrote:
    I have an EA6500 route but having problem getting wireless signal to one room in my house.  As a result, I am thinking about buying RE1000.
    If I buy this unit, will I need to connect to a different network when using wireless devices in the room near the extender.
    Or will both the extender and router operate as a single wireless network name?  If they both operate under a single wireless name, how will I know the extender is connecting and working.
    Please let me know.  Thanks.
    Just to answer your question, RE1000 will extend your router's main wireless network - so they will operate with single / same wireless network name. You'll know that the extender is connected and working if you'll be able to see the RE1000 listed on your router's DHCP client's table.
    If everyone needs to believe in something, I believe I'll have another beer..

  • Question about same emails with others

    Good afternoon, the other day I walked into
    yahoo.com, because I wondered if
    I had done earlier account there.
    So, when I tried to log in, I chose
    that I can not remember my identity
    and asked me to write the security email
    I would have put in during my
    recording time. Me, I put
    my mainly EMAIL, which is: [email protected]
    After some time I realized that
    some unknown had used my email
    as security email to his account
    on yahoo. Later I checked the
    recent activity in my email in hotmail
    and indicate places where I have not been
    in any of the times I entered my
    account. Finally, there are some messages
    about verifying my identity to an account
    of Apple, which does not come from
    me. My question is whether it is possible
    to have the same email with
    these girls, who have the same name and
    the same first letter on their surname
    as me?? Thank you in advance!

    WLS loads classes from weblogic.class.path property
    Refer this document
    http://www.weblogic.com/docs51/admindocs/classpath.html
    Kumar
    Paul Shen wrote:
    At first, thanks Jesse for the help. Sorry for my mistake that making
    question 3 out of context.
    WinNT 4.0 SP6, Weblogic 5.10, SQLServer 7.0
    I wanna create a connection pool for SQLServer. At beginning, I
    mis-add the JDBC Driver class path to weblogic.class.path. As a result
    the pool creating failed. After I add the JDBC Driver class path to
    weblogic.class.path and CLASSPATH (by wlconfig), the pool created
    succefully.
    For testing purpose, I changed weblogic.class.path back, then
    restarted NT, started Weblogic Server, to my surprise, the pool was
    created as well! How do you think about this?
    Paul
    On 22 Aug 2000 12:27:28 -0800, [email protected] (Jesse E Tilly)
    wrote:
    Comments inline...
    [email protected] (Paul Shen) wrote in <wS2iOZDX8dSgABq4nblptb+wg7Uz@
    4ax.com>:
    3. For testing purpose, I changed weblogic.class.path back, then
    restarted NT, started Weblogic Server, to my surprise, the pool was
    created as well! How do you think about this?This question seems out of context. I do not know what pool you are
    referring to, nor the actions prior to changing the classpath.
    Jesse

Maybe you are looking for