How to manage memory and threads?

Let's imagine a scenario like the following:
public class Test
   Test()
   public void execute()
    for(int i=0; i<100; i++)
         new MyThread().start();
public class MyThread
  MyThread(){}
  public void run()
    //Do some work which doesn't take a lot of "computing power" but lasts for 1-2s.
}In this example, using multiple threads should help to work quicker because you haven't to wait for one process to wait until the next can work. This works fine indeed, but it will take more memory than the non-threaded model. This is all perfect, except for one thing:
Why doesn't the VM free up the memory the threads are allocating. Imagine you call the execute method one time after another (let's say you pass different parameters so it makes sense). This would cause your VM to eventually crash because memory would get used up. (try this with a w2k or wxp task-manager).
I've read that the threads will belong to a thread-group (which one or how can I access it?) and will therefore still be referenced even though they have run out. What can I do about it?

Just in case, I forgot something:
public class Test
   Test()
    public void execute()
    for(int i=0; i<100; i++)
          new MyThread().start();
public class MyThread extends Thread
  MyThread(){}
  public void run()
    //Do some work which doesn't take a lot of "computing power" but lasts for 1-2s.
}

Similar Messages

  • How to manage slow and fast moving goods in Demand Planning

    Hi All,
    Kindly let me know how to manage slow and fast moving goods in Demand Planning.
    1. First how to detect slow and fast moving goods
    2. which DP model to use
    3. Any Best practice while dealing with slow and fast moving goods
    Thanks
    Arun

    Arun,
    There are two main concerns with forecasting slow moving goods. For fast moving, yes, trend, level and seasonality combined with a decent demand level gets you through.
    So, either you don't have demand in the market for that product; if the product is not critical (like go/no go spare parts) I recommend just averaging out the demand over a period and going with that. Any errors incurred there won't have a significant business impact. On the other hand if it is critical, safety stock and/or contractual obligations come to play.
    OR, if there is market demand but your market share is too low for whatever reason, then it gets tricky because you need a predictor variable(s) for which you have good knowledge off (such as CPI index, demand for related products, etc). The forecast is then done on the predictor variable(s) and the low market share applied to 'translate' the expected demand to the product in question. Unfortunately, the case of low demand/low market share I have no idea of how to implement it on SAP. Since forecasting is just the tip of the iceberg, it may pay to do it outside of SAP (say in Excel) and manually input it (unless the products are many and varied).
    Hope this helps. Please let me know if this makes sense and/or applies to your question.
    Rodrigo

  • How to manage pulp and paper  processing through SAP

    Hi...
    please let me know how to manage pulp and paper  processing through SAP-PP in details......
    or please provide sum links where i can get the solution....
    regards,
    sandeep.

    Hi Ema,
    you need to ensure in your BAdi implementation that the records do not overlap. Ideally (for performance reasons) you also keep the number of records in RPM_BUPA_AVL low
    i.e. one record for 01.Jan to 05 Jan with 8 hours is better compared to 5 records with 8 hours each.
    Best regards
    Thorsten

  • How to manage Rescue and Recovery Backups

    Hi I've been using disk image backup solutions since the days of powerquests Drive Image. And have had my days with Ghost and Acronis Trueimage. I recently built a clean Vista image on my T400, and I'd like to take advantage of the Lenovo Rescue and Recovery 4.21 tool since it the recovery technology is already part of my system and I have tested it once.
    I'm used to the idea that a backup tool will produce an image file, which I can manage myself, moving to various media....hiding under my bed etc. With RnR, I've noticed it prefers to control the directory's where backups are placed (this is a bit annoying to me, but I can live with it, as long as it's isolated to the RRBackup directory - which it appears may not be the case). I do appreciate it's ability to specify various backup media locations (network, CD, 2nd HDD, USB) and recognize that it's a simple approach for basic usage.
    Recently I've backed up my image to USB drive, and also to the local disk. I'd like to take that back up and split it up into DVD's and burn it to disk. I know there is a built in RnR feature which lets us copy backups from the local drive (why only local drive ??) to USB/Network/CD, but unfortunately the CD copy feature burns directly to my thinkpad burner...which is a CDR device, not a DVDR device. I'd like to use the DVDR device on my desktop...
    Anyway, I'd like to know if there is more resources on how to manage RnR Backups. I found the following guide http://www-307.ibm.com/pc/support/site.wss/MIGR-70344.html (which is hard to get on Lenovo's site...google finds it better), I'm still reading it, but so far it appears more focused on the pre-desktop area than backup management.
    Any insight would be appreciated.
    Thanks!

    Hi Danielle,
    Consider this allegory; factory settings will make your thinkpad like a never driven 0 meter car [with reference to software]. Hence it will be far-flung from it's previous state. Apart from what you have already saved on memory stick, all settings and the software you have installed on the notebook will be lost.
    I hope this helps.
    Maliha (I don't work for lenovo)
    ThinkPads:- T400[Win 7], T60[Win 7], IBM 240[Win XP]
    IdeaPad: U350
    Apple:- Macbook Air [Snow Leopard]
    Did someone help you today? Compliment them with a Kudos!
    Was your question answered today? Mark it as an Accepted Solution! 
      Lenovo Deutsche Community     Lenovo Comunidad en Español 
    Visit my YouTube Channel

  • How to allocate memory and to get the start address

    im just trying to allocate a memory of 8MB and to get the start address of that mem,  by getting the address i will access that memory by dll function..  so i want to know how to allocate the memory and to get the address.. any one knows then pls tell me

    duplicate post
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • I am completely in the dark about how to manage devices and use iTunes, are there tutorials available?

    I am completely in the dark about how to manage my iTunes and devices.
    I have a desktop with Windows 8 (ugh!!) and I have iTunes for Windows.  My wife has a iPod Touch and I have an iPad 2 and an iPhone 4S.  Currently, the only devices associated with my Apple ID are the desktop and the iPad.  How do I add the iPod and my iPhone to the devices and how do I put "puchased" iTunes on my wife's iPod when attached to the desktop?
    Thanks.
    SEE

    Try posting to the Enterprise forums... you'll probably get more appropriate responses and better exposure to individuals with similar setups/issues.

  • Monitoring memory and thread management for Java 1.4.2_04

    Hi,
    I have an application which is using Java version 1.4.2_04. The application deployed in Customer site is having some memory issues. There are observing java.exe going 100% in Task Manager. The same application (of higher version)
    uses Java 1.5 is not seeing any issues.
    Now Customer needs the root cause of the issue and i would like to check the code which is causing the issue. I came to know we can monitor threads and memory using JConsole. Since we are using Java 1.4, i installed Java 1.6 on a remote machine and tried connecting to the problematic machine. But it failed to connect.
    i have added the option "-Dcom.sun.management.jmxremote.port=8880" when starting JVM (this i have provided inside ServletExec batch file, ServletExec is my web server).
    Any idea how to connect to the problematic machine from remote using JConsole. Or any other tools i can use on Java 1.4 to nail down the problem..
    Please provide pointers.
    I have another doubt on Java version 1.4, since there were many memory issues, am i hitting any defect in Java 1.4

    hari.r wrote:
    Please provide pointers.You need to tell you sales/marketing/business requirements people that they must come up with an end of life policy for customers on older versions.
    Unless your company has a service contract with Sun you right now, can no longer insure that the VM will remain secure nor even really running.
    See the following for the java VMs that you are using.
    [http://java.sun.com/products/archive/eol.policy.html]

  • How to increase Memory and Java Heap Size for Content Server

    Hi,
    My content server is processing requests very slowly. Over performance is not good. I have 2 GB of RAM any idea what files I can modify to increase the Java Heap Size for the Content Server. If I increase the RAM to 4 or 6 GB where do I need to make changes for the Java Heap Size and what are the recommended values. I just have Content Server Running on the linux box. Or how do I assign more memory to the user that owns the content server install.
    Thanks

    You might find these interesting:
    http://blogs.oracle.com/fusionecm/2008/10/how_to_-javatuning.html
    http://download.oracle.com/docs/cd/E10316_01/cs/cs_doc_10/documentation/admin/performance_tuning_10en.pdf
    Do you have access to metalink? This has about everything you could want:
    https://metalink2.oracle.com/metalink/plsql/f?p=130:14:9940589543422282072::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,788210.1,1,1,1,helvetica
    Or search for "788210.1" in metalink knowledgebase if that link doesn't work and look for the FAQ on configuring Java for Content Servers

  • 5s: I restored an old backup with an invalid Apple ID. How to clear memory and start fresh?

    I'm changing jobs, so I bought a new 5s to replace the 5 I need to return.  When I got home, I restored an iTunes phone backup that contained my old Apple ID - which is now invalid.  The 5s is now set up to "Find My iPhone", but linked to the old Apple ID.  How to erase the phone?  Can the carrier store (AT&T) do it?  Or should I go to the Apple Store?  Thanks in advance,  -ds

    Welcome to the Apple community.
    Unfortunately you cannot transfer purchases from one account to another.
    Are you aware that the iCloud accounts and the iTunes accounts are different accounts, and that you can retain your iTunes account ID for iTunes and use your new ID for iCloud.

  • How to manage clips and Projects with external Hard drives

    I have a lot of video, I use external hard drives so my internal does not fill up. But now I have several different iMovie libraries. How do I merge them or clean up this mess. I am using the latest version of I movie 10.0.4

    Hi
    You must do this the right way.
    • EXTERNAL Hard disk - MUST - be Mac OS Extended formatted
    Nothing else will do - for VIDEO !
    • The Moving of Event's and Project's - Must be done within the iMovie Application
    Folders named iMovie Event's and iMovie Project's - can not be moved via Desktop/Finder - as links back to iMovie will break and can not be mended.
    My general note on this:
    Moving Event's and Project's
    Connection - Either connect one Mac in Target mode to the other via FireWire. Or use an external hard disk !
    (Target-Mode - Start one Mac e.g. laptop - BUT keep T-key down during full up-start - Now a FW-symbol is jumping around the screen and it will work as an external hard disk when connected to the other Mac)
    A. The External Hard Disk - MUST BE - Mac OS Extended (hfs) formatted to work for Video. UNIX/DOS/FAT32/Mac OS Exchange works for most other things but not for Video whatever program is used (iMovie or FinalCut)
    B. Should be a FireWire one as USB/USB2 performs badly to me and especially when filling up
    C. Do never Move or Alter any folder named
    • iMovie Event's - or -
    • iMovie Project's
    on DeskTop/Finder - as this will result in iMovie losing connections to them and repair can be anything from hard to impossibly.
    D. Moving and Copying must be done within iMovie application and Events to Events - and - Project's to Project's.
    E. Moving Project's to Event's - Do not work for me - I have to export project as a QuickTime movie then Import this into Events.
    Event's window can show two faces
    Like this
    or like this
    from one hard disk Event - You can move it to the other hard disk
    You can not (at least not me) move Event to Project or other way around only
    Event to Event and Project to Project
    Yours Bengt W

  • What is including in the other section of my memory and how do I manage it?

    I'm running out of memory and I can't seem to find out what is in the section labeled as other when I connect the Ipad to itunes. Can anyone help?

    that other folder is files sync'd from your pc but are not readable by the device. so try this but understand its a complete data loss and your backup will have the "other folder"  so must be set up as new.  as far a permanent fix buy a mac computer and dont sync with windows
    recovery mode
    open itunes on computer
    plug cable into computer not phone
    turn phone off
    hold home button and plug cable into phone.  do not release home button until an itunes graphic appears on device.
    look to computer should have message about recovery mode click ok and restore
    Peace, Clyde
    if u need an article see
    http://support.apple.com/kb/HT1808

  • HT4910 I have 2 lines and on 1 of the main phone I went to settings then storage & backup automatically it showed how much space i have which was not allot and it also showed the other line storage space. I click on manage storage and it used to show both

    I was told that I have 14.9 gb of space on my phone when my total is 15gb. I was adviced to free storage and to click on settings and manage my storage by either purchase more or turning off or deleting some of the back ups. When I went in to settings then to icloud it usually would of showed me both phone storage memory and when I started going down my list and turning off some of the apps from back ups of certain app all of a sudden I couldnt no longer see my phone storage memory or my account name for that matter. Now I only see the other line username and storage space that the other phone has.
    What can I do? I used to see the list of all the apps I have on icloud and now its empty and it tells me I have available 13.4 gb available.
    Please advice. Thank you
    Patricia

    I cannot find this 300GB "Backup" in the Finder, only in the Storage info when I check "About This Mac".
    You are probably using Time Machine to backup your MacBook Pro, right? Then the additional 300 GB could be local Time Machine snapshots.  Time Machine will write the hourly backups to the free space on your hard disk, if the backup drive is temporarily not connected. You do not see these local backups in the Finder, and MacOS will delete them, when you make a regular backup to Time Machine, or when you need the space for other data.
    See Pondini's page for more explanation:   What are Local Snapshots?   http://pondini.org/TM/FAQ.html
    I have restarted my computer, but the information remains the same. How do I reclaim the use of the 300GB? Why is it showing up as "Backups" when it used to indicate "Photos"? Are my photos safe on the external drive?
    You have tested the library on the external drive, and so your photos are save there.  
    The local TimeMachine snapshot probably now contains a backup of the moved library.  Try, if connecting your Time Machine drive will reduce the size of your local Time Machine snapshots.

  • How to create a file in memory and then store it in database

    Hi Guys,
    I'm wondering how could i create a file such a plain text or css styleshhet in runtime and then store this file in the database. I need to save them in the database cause the application doe not have write permission to filesystem.
    Is that possible ? Can a file be created only in memory and saved in database instead of filesystem?
    I'd appreciate your help on this.
    Thanks a lot.

    jack.black wrote:
    What i really need is to save information as a stylesheet into db. These information is input in a form and sent to a servlet. You have a servlet and in there you are creating data, lets say the data is representable as a string.
    You have a database layer (however it is implemented) which takes data (string) and stores it as a blob presumably.
    That is two distinct and completely separate processes.
    The second has nothing to do with the first because the second doesn't care how the data is created. And you should write the code for the second and test it completely independent from the first (just as all of the database layer should be handled.)
    As for the first you can use StringWriter, perhaps wrapping it in PrintWriter if you wish. Do whatever you want to put data in there. Be sure to close it, extract the string and then use it.
    The only limitation to processing like this is that if the data gets too large (individually or due to number of threads) it could adversely impact the application.

  • 32gig Memory on Macpro 8 Core - How to use it all the memory and processor speed

    Hello Everyone,
    I was wondering if any of you out there know a way to have my Mac Pro use more of the memory it has. I have 32gig of memory and I would like to have it use more processor power and memory if possible. I am aware you can use the "renice -10 -p PIDNUMBER"
    How can I make it use more of the processors and memory my machine has. Ex. Running Photoshop or Final Cut, Imovie etc.

    Using the Unix nice command raises the priority of a process, but software will use the amount of memory it needs.  You cannot make a program use memory it does not need.  Same with processor cores, if software is written to use only one processor or core you cannot make it use more, the software has to be designed for multi-threading to do that.

  • How to format Memory card in N79 and 5630 Xpressmu...

    Hi everyone,
    I am using N79 amd 5630 Xpressmusic. Can any body tell me how to format the memory card in these sets. Coz in file manager there is no option to format memory card.
    Regards

    Hi Sappal,
    To format the memory card follow the below procedure:
    1. Go to "File Manager-> Memory Card" (I've named the memory card as N79).
    2. You will need to open the memory card and then go to its "Options" menu.
    3. Go to "Memory Card Options-> Format" and confirm.
    Please note that the memory card will not get formatted unless every application is closed and you have not installed any third party applications on it. For this, you will have to uninstall any third party applications and only then proceed with the memory card formatting procedure.
    Let me know if you need any assistance. My id is  
    Regards,
    Rahul
    moderator's note:
    removed personal contact information as it is inaappropriate to publish personal contact information on a public web forum.
    Rahul.Savaikar

Maybe you are looking for