Array Allocation and Memory

I can create this array without a problem:
private float[][][] floats = new float[170][170][170];
This one causes an error:
private float[][][][] floats = new float[170][170][170][1];
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
I am using -J-Xms350m and -J-XX:MaxPermSize=500m
Setting Xms350m to 400 stops Netbeans from starting, even though I have 3GB ram, and 50% of my physical memory is available according to taskmanager.
I need to have three of the following array:
private float[][][][] floats = new float[169][169][169][15];
How can I do this so that the program will run in JVM?
Do I have to switch to another language, such as C, for this?
I actually do need to use all of this memory at once. There is nothing that I can do to reduce it. I have millions of unique values to store and manipulate.

cyzo wrote:
Its "The only IDE you need."
I can run netbeans with "-J-Xss2m -J-Xms128m -J-Xmx1000m -J-XX:PermSize=32m -J-XX:MaxPermSize=512m"
I still get the heap size error.-Xmx1000m is for your java application and not for the NB ide. Did you get me correct?
$>java -cp yourClassPaths -Xmx1000m yourJavaApplication

Similar Messages

  • How to get the total allocated CPUs, memory and storage in a particualr reservation through vRealize Automation Java SDK?

    I am trying to figure out how to get the total allocated CPUs, memory and storage in a particualr reservation through vRealize Automation Java SDK.

    I am trying to figure out how to get the total allocated CPUs, memory and storage in a particualr reservation through vRealize Automation Java SDK.

  • How to check actual allocated and used memory for java process in solaris?

    Hi,
    I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
    I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
    So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
    Thank you.

    With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
    With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
    Nick.

  • How to find the current CPU and Memory (RAM) allocation for OMS and Reposit

    Hi There,
    How do I check the CPU and memory (RAM) allocation for the OMS and the Repository database? I'm following the "Oracle Enterprise Manager Grid Control Installation and Configuration Guide 10g Release 5 (10.2.0.5.0)" documentation and it says to ensure the following:
    Table 3-1 CPU and Memory Allocation for Oracle Management Service
    Deployment Size Host CPU/Host Physical Memory (RAM)/Host Total Recommended Space
    Small (100 monitored targets)                   1                                             1 (3 GHz)                            2 GB                                                                        2 GB
    ***Table 3-2 CPU and Memory Allocation for Oracle Management Repository***
    Deployment Size Host CPU/Host Physical Memory (RAM)/Host Total Recommended Space
    Small (100 monitored targets)                   1                                   1 (3 GHz)                                        2 GB                                                                          10 GB
    Thanks,
    J

    Hi J,
    This is the minimum requirement. However It will work fine.
    Also read below article on "Oracle Enterprise Manager Grid Control Architecture for Very Large Sites"
    http://www.oracle.com/technology/pub/articles/havewala-gridcontrol.html
    For GRID HA solution implementation please read :
    http://www.oracle.com/technology/deploy/availability/pdf/MAA_WP_10gR2_EnterpriseManagerBestPractices.pdf
    Regards
    Rajesh

  • Custom MediaStreamSource and Memory Leaks During SampleRequested

    Greetings,
    I have a nasty memory leak problem that is causing me to pull my hair out.
    I'm implementing a custom MediaStreamSource along with MediaTranscoder to generate video to disk. The frame generation operation occurs in the SampleRequested handler (as in the MediaStreamSource example). No matter what I do - and I've tried a
    ton of options - inevitably the app runs out of memory after a couple hundred frames of HD video. Investigating, I see that indeed GC.GetTotalMemory reports an increasing, and never decreasing, amount of allocated RAM. 
    The frame generator in my actual app is using RenderTargetBitmap to get screen captures, and is handing the buffer to MediaStreamSample.CreateFromBuffer(). However, as you can see in the example below, the issue occurs even with a dumb allocation
    of RAM and no other actual logic. Here's the code:
    void _mss_SampleRequested(Windows.Media.Core.MediaStreamSource sender, MediaStreamSourceSampleRequestedEventArgs args)
    if ( args.Request.StreamDescriptor is VideoStreamDescriptor )
    if (_FrameCount >= 3000) return;
    var videoDeferral = args.Request.GetDeferral();
    var descriptor = (VideoStreamDescriptor)args.Request.StreamDescriptor;
    uint frameWidth = descriptor.EncodingProperties.Width;
    uint frameHeight = descriptor.EncodingProperties.Height;
    uint size = frameWidth * frameHeight * 4;
    byte[] buffer = null;
    try
    buffer = new byte[size];
    // do something to create the frame
    catch
    App.LogAction("Ran out of memory", this);
    return;
    args.Request.Sample = MediaStreamSample.CreateFromBuffer(buffer.AsBuffer(), TimeFromFrame(_FrameCount++, _frameSource.Framerate));
    args.Request.Sample.Duration = TimeFromFrame(1, _frameSource.Framerate);
    buffer = null; // attempt to release the memory
    videoDeferral.Complete();
    App.LogAction("Completed Video frame " + (_FrameCount-1).ToString() + "\n" +
    "Allocated memory: " + GC.GetTotalMemory(true), this);
    return;
    It usually fails around frame 357, with GC.GetTotalMemory() reporting 750MB allocated.
    I've tried tons of work-arounds, none of which made a difference. I tried putting the code that allocates the bytes in a separate thread - no dice.  I tried Task.Delay to give the GC a chance to work, on the assumption that it just had no time
    to do its job. No luck.
    As another experiment, I wanted to see if the problem went away if I allocated memory each frame, but never assigned it to the MediaStreamSample, instead giving the sample (constant) dummy data. Indeed, in that scenario, memory consumption stayed
    constant. However, while I never get an out-of-memory exception, RequestSample just stops getting called around frame 1600 and as a result the transcode operation never actually returns to completion.
    I also tried taking a cue from the SDK sample which uses C++ entirely to generate the frame. So I passed the buffer as a Platform::Array<BYTE> to a static Runtime extension class function I wrote in C++.
    I won't bore you with the C++ code, but even directly copying the bytes of the array to the media sample using memcpy still had the same result! It seems that there is no way to communicate the contents of the byte[] array to the media sample without
    it never being released.
    I know what some will say: the difference between my code and the SDK sample, of course, is that the SDK sample generates the frame _entirely_ in C++, thus taking care of its own memory allocation and deallocation. Because I want to get
    the data from RenderTargetBitmap, this isn't an option for me. (As a side note, if anyone knows if there's a way to get the contents of an RT Window using DirectX, that might work too, but I know this is not a C++ forum, so...). But more importantly,
    MediaStreamSource and MediaStreamSample are managed classes that appear to allow you to generate custom frames using C# or other managed code. The MediaStreamSample.CreateFromBuffer function appears to be tailored for exactly what I want. But there appears
    to be no way to release the buffer when giving the bytes to the MediaStreamSample. At least none that I can find.
    I know the RT version of these classes are new to Windows 8.1, but I did see other posts going back 3 years discussing a similar issue in Silverlight. That never appears to have been resolved.
    I guess the question boils down to this: how do I safely get managed data, allocated during the SampleRequested handler, to the MediaStreamSample without causing a memory leak? Also, why would the SampleRequested handler just stop getting called
    out of the blue, even when I artificially eliminate the memory leak problem?
    Thanks so much for all input!

    Hi Rob - 
    Thanks for your quick reply and for clarifying the terminology. 
    In the Memory Usage test under Analyze/Performance and Diagnostics (is that what you mean?) it's clear that each frame of video being created is not released from memory except when memory consumption gets very high. GC will occasionally kick in, but eventually
    it succumbs.
    Interestingly, if I reduce the frame size substantially, say 320x240, it never runs out of RAM no matter how many frames I throw at it. The Memory Usage test, however, shows the same pattern. But this time the GC can keep up and release the RAM.
    After playing with this ad nauseum,  I am fairly convinced I know what the problem is, but the solution still escapes me. It appears that the Transcoder is requesting frames from the MediaStreamSource (and the MediaStreamSource is providing them via
    my SampleRequested handler) faster than the Transcoder can write them to disk and release them. Why would this be happening? The MediaStreamSource.BufferTime property is - I thought - used to prevent this very problem. However, changing the BufferTime seems
    to have no effect at all - even changing it to ZERO doesn't change anything. If I'm right, this would explain why the GC can't do its job - it can't release the buffers I'm giving to the Transcoder via SampleRequested because the Transcoder won't give them
    up until it's finished transcoding and writing them to disk. And yet the transcoder keeps requesting samples until there's no more memory to create them with.
    The following code, which I made from scratch to illustrate my scenario, should be air-tight according to everything I've read. And yet, it still runs out of memory when the frame size is too large. 
    If you or anyone else can spot the problem in this code, I'd be thrilled to hear it. Maybe I'm omitting a key step with regard to getting the deferral? Or maybe it's a bug in the back-end? Can I "slow down" the transcoder and force it to release samples
    it's already used?
    Anyway here's the new code, which other than App.cs is everything. So if I'm doing something wrong it will be in this module:
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Threading.Tasks;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using System.Diagnostics;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Navigation;
    using Windows.UI.Popups;
    using Windows.Storage;
    using Windows.Storage.Pickers;
    using Windows.Storage.Streams;
    using Windows.Media.MediaProperties;
    using Windows.Media.Core;
    using Windows.Media.Transcoding;
    // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
    namespace MyTranscodeTest
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    MediaTranscoder _transcoder;
    MediaStreamSource _mss;
    VideoStreamDescriptor _videoSourceDescriptor;
    const int c_width = 1920;
    const int c_height = 1080;
    const int c_frames = 10000;
    const int c_frNumerator = 30000;
    const int c_frDenominator = 1001;
    uint _frameSizeBytes;
    uint _frameDurationTicks;
    uint _transcodePositionTicks = 0;
    uint _frameCurrent = 0;
    Random _random = new Random();
    public MainPage()
    this.InitializeComponent();
    private async void GoButtonClicked(object sender, RoutedEventArgs e)
    Windows.Storage.Pickers.FileSavePicker picker = new Windows.Storage.Pickers.FileSavePicker();
    picker.FileTypeChoices.Add("MP4 File", new List<string>() { ".MP4" });
    Windows.Storage.StorageFile file = await picker.PickSaveFileAsync();
    if (file == null) return;
    Stream outputStream = await file.OpenStreamForWriteAsync();
    var transcodeTask = (await this.InitializeTranscoderAsync(outputStream)).TranscodeAsync();
    transcodeTask.Progress = (asyncInfo, progressInfo) =>
    Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
    _ProgressReport.Text = "Sourcing frame " + _frameCurrent.ToString() + " of " + c_frames.ToString() +
    " with " + GC.GetTotalMemory(false).ToString() + " bytes allocated.";
    await transcodeTask;
    MessageDialog dialog = new MessageDialog("Transcode completed.");
    await dialog.ShowAsync();
    async Task<PrepareTranscodeResult> InitializeTranscoderAsync (Stream output)
    _transcoder = new MediaTranscoder();
    _transcoder.HardwareAccelerationEnabled = false;
    _videoSourceDescriptor = new VideoStreamDescriptor(VideoEncodingProperties.CreateUncompressed( MediaEncodingSubtypes.Bgra8, c_width, c_height ));
    _videoSourceDescriptor.EncodingProperties.PixelAspectRatio.Numerator = 1;
    _videoSourceDescriptor.EncodingProperties.PixelAspectRatio.Denominator = 1;
    _videoSourceDescriptor.EncodingProperties.FrameRate.Numerator = c_frNumerator;
    _videoSourceDescriptor.EncodingProperties.FrameRate.Denominator = c_frDenominator;
    _videoSourceDescriptor.EncodingProperties.Bitrate = (uint)((c_width * c_height * 4 * 8 * (ulong)c_frDenominator) / (ulong)c_frNumerator);
    _frameDurationTicks = (uint)(10000000 * (ulong)c_frDenominator / (ulong)c_frNumerator);
    _frameSizeBytes = c_width * c_height * 4;
    _mss = new MediaStreamSource(_videoSourceDescriptor);
    _mss.BufferTime = TimeSpan.FromTicks(_frameDurationTicks);
    _mss.Duration = TimeSpan.FromTicks( _frameDurationTicks * c_frames );
    _mss.Starting += _mss_Starting;
    _mss.Paused += _mss_Paused;
    _mss.SampleRequested += _mss_SampleRequested;
    MediaEncodingProfile outputProfile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Ntsc);
    outputProfile.Audio = null;
    return await _transcoder.PrepareMediaStreamSourceTranscodeAsync(_mss, output.AsRandomAccessStream(), outputProfile);
    void _mss_Paused(MediaStreamSource sender, object args)
    throw new NotImplementedException();
    void _mss_Starting(MediaStreamSource sender, MediaStreamSourceStartingEventArgs args)
    args.Request.SetActualStartPosition(new TimeSpan(0));
    /// <summary>
    /// This is derived from the sample in "Windows 8.1 Apps with Xaml and C# Unleashed"
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="args"></param>
    void _mss_SampleRequested(MediaStreamSource sender, MediaStreamSourceSampleRequestedEventArgs args)
    if (_frameCurrent == c_frames) return;
    var deferral = args.Request.GetDeferral();
    byte[] frameBuffer;
    try
    frameBuffer = new byte[_frameSizeBytes];
    this._random.NextBytes(frameBuffer);
    catch
    throw new Exception("Sample source ran out of RAM");
    args.Request.Sample = MediaStreamSample.CreateFromBuffer(frameBuffer.AsBuffer(), TimeSpan.FromTicks(_transcodePositionTicks));
    args.Request.Sample.Duration = TimeSpan.FromTicks(_frameDurationTicks);
    args.Request.Sample.KeyFrame = true;
    _transcodePositionTicks += _frameDurationTicks;
    _frameCurrent++;
    deferral.Complete();
    Again, I can't see any reason why this shouldn't work. You'll note it mirrors pretty closely the sample in the Windows 8.1 Apps With Xaml Unleashed book (Chapter 14). The difference is I'm feeding the samples to a transcoder rather than a MediaElement (which,
    again should be no issue).
    Thanks again for any suggestions!
    Peter

  • Flash lite and Memory

    Hi everyone,
    I am loading 4 xmls in my application whose size is not more
    than 200 KB. My application is 75 KB.
    I am loading these xmls into their respective arrays. I
    tested this application on E51 and it is installed on memory card.
    When I am manpulating the array contents and send this
    content to the server sometimes I am getting memory overflow error.
    I have kept track of the memory which I noticed at one point
    of time exceeds 2 MB and overflow error occurs.
    I tried freeing the xml objects using <xmlObject>=null
    after loading the contents into respective arrays, but still the
    memory freed is very little.
    How do I solve this issue?
    Moreover the static and dynamic heap memory for flash lite
    applications varies from device to device. Is there any way to
    extend the memory or use virtual memory sort of thing when the
    application is installed in memory card instead of phone memory
    itself.

    Hi Alex,
    I am not "from" Adobe but I have been playing with FL for a
    while and I am an ACE. For a Qualcomm specific question you may
    want to try thte qualcomm forums (
    http://brewforums.qualcomm.com/)
    but in the meantime, I can at least tell you what has been working
    for me.
    Add the code used here to you movie (but remember that adding
    this debugger will add to the memory load)::
    I hope that helped. The biggest message—test on your
    device **(but suprissingly, the numbers on my Flash (not qualcomm)
    emulator when targeting my exact device are the same as on the
    device. Once it gets below 70% the device throws memory errors.
    Also, make sure you do garbage collection (search term in FL help
    file) otherwise as your program stays on it could throw errors.
    (i.e. After 20 minutes the device could throw a memory error but
    not right away. This actually happend to me.).
    *p.s. Obviously functions require FL 2.0 and not 1.1, but we
    are in the BREW forum. To be backwards compatable to FL 1.1 you
    would need a frames based method to measure time.
    Best,

  • Running 5 commands using array elements and waiting between?

    Hi All,
    Trying to learn PS so please be patient with me ;)
    System: PSv3 on Win2012 server running WSUS role
    I am wanting to execute 5 commands using a 'foreach' loop but wait until one finishes before moving onto the next. Can you please check out what I have and provide some suggestions of improvement? or scrap it completely if it's rubbish :(
    Current code:
    #### SCRIPT START ####
    #Create and define array and elements
    $Array1 = @(" -CleanupObsoleteComputers"," -DeclineSupersededUpdates -DeclineExpiredUpdates"," -CleanupObsoleteUpdates"," -CleanupUnneededContentFiles"," -CompressUpdates")
    #Run the cleanup command against each element
    foreach ($element in $Array1) {
    Get-WsusServer | Invoke-WsusServerCleanup $element -Whatif
    #### SCRIPT END ####
    I am assuming that I need to use @ to explicitly define elements since my second element contains two commands with a space between?
    The cleanup command doesn't accept '-Wait' so I'm not sure how to implement a pause without just telling it to pause for x time; not really a viable solution for this as the command can sometime take quite a while. They are pretty quick now that I do
    this all the time but just want it to be future proof and fool proof so it doesn't get timeouts as reported by others.
    I have found lots of code on the net for doing this remotely and calling the .NET assemblies which is much more convoluted. I however want to run this on the server directly as a scheduled task and I want each statement to run successively so it
    doesn't max out CPU and memory, as can be the case when a single string running all of the cleanup options is passed.
    Cheers.

    Thank you all for your very helpful suggestions, I have now developed two ways of doing this. My original updated (thanks for pointing me in the right direction Fred) and Boe's tweaked for my application (blew my mind when I first read that API code
    Boe). I like the smaller log file mine creates which doesn't really matter because I am only keeping the last run data before trashing it anyway. I have also removed the verbose as I will be running it on a schedule when nobody will be accessing it anyway,
    but handy to know the verbose commands ;)
    Next question: How do I time these to see which way is more efficient?
    My Code:
    $Array1 = @("-CleanupObsoleteComputers","-DeclineSupersededUpdates","-DeclineExpiredUpdates","-CleanupObsoleteUpdates","-CleanupUnneededContentFiles","-CompressUpdates")
    $Wsus = Get-WsusServer
    [String]$Logfile = 'C:\Program Files\Update Services\LogFiles\ArrayWSUSCleanup.log'
    [String]$Logfileold = 'C:\Program Files\Update Services\LogFiles\ArrayWSUSCleanup.old'
    If (Test-Path $Logfileold){
    Remove-Item $Logfileold
    If (Test-Path $Logfile){
    Rename-Item $Logfile $Logfileold
    foreach ($Element in $Array1)
    Get-Date | Out-File -FilePath $LogFile -Append -width 50
    Write-Output "Performing: $($Element)" | Out-File -FilePath $LogFile -Append -width 100
    . Invoke-Expression "`$Wsus | Invoke-WsusServerCleanup $element" | Out-File -FilePath $LogFile -Append -width 100
    Logfile Output {added 1 to show what it looks like when items are actions}:
    Wednesday, 27 August 2014 2:14:01 PM
    Obsolete Computers Deleted:1
    Wednesday, 27 August 2014 2:14:03 PM
    Obsolete Updates Deleted:1
    Wednesday, 27 August 2014 2:14:05 PM
    Expired Updates Declined:1
    Wednesday, 27 August 2014 2:14:07 PM
    Obsolete Updates Deleted:1
    Wednesday, 27 August 2014 2:14:09 PM
    Diskspace Freed:1
    Wednesday, 27 August 2014 2:14:13 PM
    Updates Compressed:1
    Boe's Updated Code:
    [String]$WSUSServer = 'PutWSUSServerNameHere'
    [Int32]$Port = 8530 #Modify to the port your WSUS connects on
    [String]$Logfile = 'C:\Program Files\Update Services\LogFiles\APIWSUSCleanup.log'
    [String]$Logfileold = 'C:\Program Files\Update Services\LogFiles\APIWSUSCleanup.old'
    If (Test-Path $Logfileold){
    Remove-Item $Logfileold
    If (Test-Path $Logfile){
    Rename-Item $Logfile $Logfileold
    [Void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($WSUSServer,$False,$Port)
    $CleanupMgr = $Wsus.GetCleanupManager()
    $CleanupScope = New-Object Microsoft.UpdateServices.Administration.CleanupScope
    $Properties = ("CleanupObsoleteComputers","DeclineSupersededUpdates","DeclineExpiredUpdates","CleanupObsoleteUpdates","CleanupUnneededContentFiles","CompressUpdates")
    For ($i=0;$i -lt $Properties.Count;$i++) {
    $CleanupScope.($Properties[$i])=$True
    0..($Properties.Count-1) | Where {
    $_ -ne $i
    } | ForEach {
    $CleanupScope.($Properties[$_]) = $False
    Get-Date | Out-File -FilePath $LogFile -Append -width 50
    Write-Output "Performing: $($Properties[$i])" | Out-File -FilePath $LogFile -Append -width 100
    $CleanupMgr.PerformCleanup($CleanupScope) | Out-File -FilePath $LogFile -Append -width 200
    Logfile Output {added 1 to show what it looks like when items are actions}:
    Wednesday, 27 August 2014 2:32:30 PM
    Performing: CleanupObsoleteComputers
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 1
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:32 PM
    Performing: DeclineSupersededUpdates
    SupersededUpdatesDeclined : 1
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:34 PM
    Performing: DeclineExpiredUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 1
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:36 PM
    Performing: CleanupObsoleteUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 1
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0
    Wednesday, 27 August 2014 2:32:38 PM
    Performing: CleanupUnneededContentFiles
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 0
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 1
    Wednesday, 27 August 2014 2:32:43 PM
    Performing: CompressUpdates
    SupersededUpdatesDeclined : 0
    ExpiredUpdatesDeclined    : 0
    ObsoleteUpdatesDeleted    : 0
    UpdatesCompressed         : 1
    ObsoleteComputersDeleted  : 0
    DiskSpaceFreed            : 0

  • Allocated heap memory goes up even when there is enough free memory

    Hi,
    Our Java application's memory usage keep growing. Further analysis of the heap memory using JProbe shows that the allocated heap memory goes up even when there is enough free memory available in the heap.
    When the process started, allocated heap memory was around 50MB and the memory used was around 8MB. After few hours, the inuse memory remains at 8MB (slight increase in KBs), but the allocated memory went upto 70MB.
    We are using JVM 1.5_10. What could be the reason for heap allocation going up even when there is enough free memory available in heap?
    -Rajesh.

    Hi Eric,
    Please check if there is any error or warning in the Event Viewer based on the data time?
    If there is any error, please post the event ID to help us to troubleshoot.
    Best Regards,
    Anna

  • Array as Shared Memory - performance bottleneck

    Array as shared memory - performance bottleneck
    Hello,
    currently I work on a multi-threaded application, where many threads work on shared memory.
    I wondering why the application doesn't become faster by using many threads (I have i7 machine).
    Here is an example for initialization in single thread:
              final int arrayLength = (int)1e7;
              final int threadNumber = Runtime.getRuntime().availableProcessors();
              long startTime;
               * init array in single thread
              Integer[] a1 = new Integer[arrayLength];
              startTime = System.currentTimeMillis();
              for(int i=0; i<arrayLength; i++){
                   a1[i] = i;
              System.out.println("single thread=" + (System.currentTimeMillis()-startTime));and here initialization with many threads:
               * init array in many threads
              final Integer[] a3 = new Integer[arrayLength];
              List<Thread> threadList = new ArrayList<Thread>();
              for(int i=0; i<threadNumber; i++){
                   final int iF = i;
                   Thread t = new Thread(new Runnable(){
                        @Override
                        public void run() {
                             int end = (iF+1)*offset;
                             if(iF==(threadNumber-1))
                                  end = a3.length;
                             for(int i=iF*offset; i<end; i++){
                                  a3[i] = i;
                   threadList.add(t);
              startTime = System.currentTimeMillis();
              for(Thread t:threadList)
                   t.start();
              for(Thread t:threadList)
                   t.join();After execution it looks like this:
    single thread=2372
    many threads List=3760I have i7 4GB RAM
    System + Parameters:
    JVM-64bit JDK1.6.0_14
    -Xmx3g
    Why the executing of one thread is faster as executing of many threads?
    As you can see I didn't use any synchronization.
    Maybe I have to configure JVM in some way to gain wished performance (I expected the performance gain on i7 x8 times) ?

    Hello,
    I'm from [happy-guys|http://www.happy-guys.com] , and we developed new sorting-algorithm to sort an array on the multi-core machine.
    But after the algorithm was implemented it was a little-bit slower as standard sorting-algorithm from JDK (Array.sort(...)). After searching for the reason, I created performance tests which shows that the arrays in Java don't allow to access them by many threads at the same time.
    The bad news is: different threads slowdown each-other even if they use different array-objects.
    I believe all array-objects are natively managed by a global manager in JVM, thus this manager builds a global-lock for all threads.
    Only one thread can access any array at the same time!
    I used:
    Software:
    1)Windows Vista 64bit,
    2) java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)
    Hardware:
    Intel(R) Core(TM) i7 CPU 920 @ 2,67GHz 2,79 GHz, 6G RAM
    Test1: initialization of array in a single thread
    Test2: the array initialization in many threads on the single array
    Test3: array initialization in many threads on many arrays
    Results in ms:
    Test1 = 5588
    Test2 = 4976
    Test3 = 5429
    Test1:
    package org.happy.concurrent.sort.forum;
    * simulates the initialization of array in a single thread
    * @author Andreas Hollmann
    public class ArraySingleThread {
         public static void main(String[] args) throws InterruptedException {
              final int arrayLength = (int)2e7;
              long startTime;
                    * init array in single thread
                   Integer[] a1 = new Integer[arrayLength];
                   startTime = System.currentTimeMillis();
                   for(int i=0; i<arrayLength; i++){
                        a1[i] = i;
                   System.out.println("single thread=" + (System.currentTimeMillis()-startTime));
    }Test2:
    package org.happy.concurrent.sort.forum;
    import java.util.ArrayList;
    import java.util.List;
    * simulates the array initialization in many threads on the single array
    * @author Andreas Hollmann
    public class ArrayManyThreads {
         public static void main(String[] args) throws InterruptedException {
              final int arrayLength = (int)2e7;
              final int threadNumber = Runtime.getRuntime().availableProcessors();
              long startTime;
              final int offset = arrayLength/threadNumber;
                    * init array in many threads
                   final Integer[] a = new Integer[arrayLength];
                   List<Thread> threadList = new ArrayList<Thread>();
                   for(int i=0; i<threadNumber; i++){
                        final int iF = i;
                        Thread t = new Thread(new Runnable(){
                             @Override
                             public void run() {
                                  int end = (iF+1)*offset;
                                  if(iF==(threadNumber-1))
                                       end = a.length;
                                  for(int i=iF*offset; i<end; i++){
                                       a[i] = i;
                        threadList.add(t);
                   startTime = System.currentTimeMillis();
                   for(Thread t:threadList)
                        t.start();
                   for(Thread t:threadList)
                        t.join();
                   System.out.println("many threads List=" + (System.currentTimeMillis()-startTime));
    }Test3:
    package org.happy.concurrent.sort.forum;
    import java.util.ArrayList;
    import java.util.List;
    * simulates the array initialization in many threads on many arrays
    * @author Andreas Hollmann
    public class ArrayManyThreadsManyArrays {
         public static void main(String[] args) throws InterruptedException {
              final int arrayLength = (int)2e7;
              final int threadNumber = Runtime.getRuntime().availableProcessors();
              long startTime;
              final int offset = arrayLength/threadNumber;
                    * init many arrays in many threads
                   final ArrayList<Integer[]> list = new ArrayList<Integer[]>();
                   for(int i=0; i<threadNumber; i++){
                        int size = offset;
                        if(i<(threadNumber-1))
                             size = offset + arrayLength%threadNumber;
                        list.add(new Integer[size]);
                   List<Thread> threadList = new ArrayList<Thread>();
                   for(int i=0; i<threadNumber; i++){
                        final int index = i;
                        Thread t = new Thread(new Runnable(){
                             @Override
                             public void run() {
                                  Integer[] a = list.get(index);
                                  int value = index*offset;
                                  for(int i=0; i<a.length; i++){
                                       value++;
                                       a[i] = value;
                        threadList.add(t);
                   startTime = System.currentTimeMillis();
                   for(Thread t:threadList)
                        t.start();
                   for(Thread t:threadList)
                        t.join();
                   System.out.println("many threads - many List=" + (System.currentTimeMillis()-startTime));
    }

  • SESSION_PER_USER limit of the user profile and memory Oracle 11g

    Hi,
    I am new to oracle 11g.
    My applications are facing some problem hosted over oracle 11g and this issue appearing because of there is not sufficient sessions available.
    Here is current setting
    CPU count                    2
    Parallel Thred per CPU               2
    Resource Manager CPU allocation     2
    Shared mamory address          0
    Memory MAX target               6GB
    Memory Target               6GB
    Total Size of DB               75
    Used Size of DB               55
    Sessions -MAX               555
    Processes-MAX               500
    We want following settings
    Total Size of DB               75
    Used Size of DB               55
    Sessions -MAX               1200
    Processes-MAX               800
    Here is my qurey
    Is there any relationship between memory allocated to database and Sessions -MAX & Processes-MAX or CPU allocated .
    and whats best setting we can get for Sessions -MAX & Processes-MAX for given configuration of CPU and memory ?
    Thanks
    Edited by: user13714831 on Jul 22, 2011 12:54 PM

    limit number of session per user using wired dot1x is not available in 1.3

  • If i load 1GB file in labview array, it shows memory full. How tom handle it?

    if i load 1GB file in labview array, it shows memory full. How tom handle it?

    Don't read it all at once.  Just read the parts you need when you need it.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to find CPU and Memory Utilization

    Hi,
    How to find CPU and Memory Utilization of my application which is
    running in solaris workstation.My application has a management console in which we need to update the cpu and memory periodically.
    (Notr : Usage of JNI is restrcited)
    Thnx and Rgds,
    Mohan

    There is no CPU usage API in Java. You need some JNI code. For memory usage see the Runtime methods:
         * Get information of memory usage: max, total, free and (available/used).
         * <ul>
         * <li>Max is the maximum amount of bytes the application can allocate (see also java options -Xmx). This value is fixed.
         * If the application tries to allocate more memory than Max, an OutOfMemoryError is thrown.
         * <li>Total is the amount of bytes currently allocated from the JVM for the application.
         * This value just increases (and doesn't decrease) up to the value of Max depending on the applications memory
         * requirements.
         * <li>Free is the amount of memory that once was occupied by the application but is given back to the JVM. This value
         * varies between 0 and Total.
         * <li>The used amount of memory is the memory currently allocated by the application. This value is always less or equal
         * to Total.
         * <li>The available amount of memory is the maximum number of bytes that can be allocated by the application (Max - used).
         * </ul>
         * In brief: used <= total <= max
         * <p>
         * The JVM can allocate up to 64MB (be default) system memory for the application. If more is required, the JVM has to be started with the Xmx option
         * (e.g. "java -Xmx128m" for 128 MB). The amount of currently allocated system memory is Total. As the JVM can't give back unallocated memory
         * to the operating system, Total can just increase (up to Max).
         * @return Memory info.
        static public String getMemoryInfo() {
            StringBuilder sb = new StringBuilder();
            sb.append("Used: ");
            sb.append(toMemoryFormat(getUsedMemory()));
            sb.append(", Available: ");
            sb.append(toMemoryFormat(getAvailableMemory()));
            sb.append(" (Max: ");
            sb.append(toMemoryFormat(Runtime.getRuntime().maxMemory()));
            sb.append(", Total: ");
            sb.append(toMemoryFormat(Runtime.getRuntime().totalMemory()));
            sb.append(", Free: ");
            sb.append(toMemoryFormat(Runtime.getRuntime().freeMemory()));
            sb.append(")");
            return sb.toString();
        }//getMemoryInfo()

  • Cisco callmanager cpu and memory high utillization

    Hi,
    I just know from the information posted in NetPros which explained that disk usage of 93 % it is norm.
    Would like to know how about the inactive disk ? Is it ok that is around 91% ?
    As for the memory heavy usage of 20xxxxx K and left only 19xxxK. Is it norm ?
    What causes the heavy usage of memory and the inactive disk high percentage of usage ?
    Appreciate the explanation and workaround if there are any.

    as i mentioned, the high mem is due to linux. if you're familiar with linux you will understand how linux works. we do not have any public docs on what you ask. you can do some research on how linux platform works for a better understanding because what you ask is due to the usage of linux as the OS
    the HDD space is also filled in that high because all of the partitions that linux creates on it and because most of the space is already preassigned to the linux core files, the CUCM and others. the CAR DB is preassigned 6 gigs and cannot grow more than that as an example.
    no way to wipe out the inactive partition, it will always have the "old version" and that is the way this was designed to have it as a backup for emergencies
    show diskusage
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/rel_notes/5_1_3/513cmrn.html#wp221569
    http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/service/6_0_1/admin/sacdrm.html
    The default disk allocation and range varies depending on the size of the server hard drive. However, the maximum CAR database size is 6 GB.
    usually if you have less than 98% of disk usage you're fine.
    HTH
    javalenc
    if this helps, please rate

  • Get CPU and memory usage

    Hi!
    I would like to know if there is any way of getting system CPU and memory usage using Java code.

    I want to get the system CPU and memory usage using the performance monitor dll, the perfctrs.dll, but access this data using Java language.Then you should create wrapper dll between your java code and perfctrs.dll and convert data from format of dll to format of your java code.
    So, that is next question - how to create wrapper dll, how to deal with or how perfctrs.dll works?

  • What is the difference between Azure RemoteApp Basic vs Standard Plans in terms of compute cores and memory?

    So our customer has asked us to compare compare Amazon Workspace and Azure RemoteApp offerings for them to choose from. While looking at Amazon Workspace, it clealy defines bundles with specific CPU cores, memory and user storage. However, Azure RemoteApp
    only specifies user storage and vaguely compares its basic vs. standard plans in terms of "task worker" vs. "information worker"
    I tried looking up its documentation but couldn't find specific CPU cores that are dedicated per user in basic vs. standard plans. I have following questions:
    Can anyone point me in the right direction or help understand how many CPU cores and memory are dedicated (or shared) per user in each plan?
    Our customer would most likely need a "custom" image for their custom apps. Is it possible for us to choose specific CPU cores and memory for the users to be able to run their apps in azure remoteapp?
    In case i am misunderstanding the basic difference between AWS workspace and Azure RemoteApp, i'd appreciate some help in understanding it as well.
    Thanks!

    Hi,
    With Azure RemoteApp users see just the applications themselves, and the applications appear to be running on their local machine similar to other programs.  With Workspaces users connect to a full desktop and launch applications within that.
    1. Azure RemoteApp currently uses size A3 Virtual Machines, which have 4 vCPUs and 7GB RAM.  Under Basic each VM can have a maximum of 16 users using it whereas under Standard each VM is limited to 10 users.  The amount of CPU available
    to a user depends on what the current demands are on the CPU at that moment from other users and system processes that may be on the server.
    For example, say a user is logged on to a VM with 3 other users and the other users are idle (not consuming any CPU).  At that moment the user could use all 4 vCPUs if a program they are running needed to.  If a few moments later
    the other 3 users all needed lots of CPU as well, then the first user would only have approximately 1 vCPU for their use.  The process is dynamic and seeks to give each user their fair share of available CPU when there are multiple users demanding CPU.
    Under the Standard plan a user will receive approximately a minimum of .4 vCPU assuming that the VM has the maximum number of users logged on and that all users are using as much CPU as possible at a given moment.  Under the Basic plan the approximate
    minimum would be .25 vCPU.
    2. You cannot choose the specific number of cores and memory.  What you can do is choose the Azure RemoteApp billing plan, which affects the user density of each VM as described above.  If you need a lower density than Standard you
    may contact support.
    -TP

Maybe you are looking for

  • System and sysaux tablespace

    hi, can anyone tell me whata system and sysaux tablespace contains, and how to manage them.

  • BAPI_PO_CREATE1 Error related to Fiscal year variant

    Hi, I am working on open PO tranfer program. initialy i have created one PO from ME21n tcode, and its worked out fine now using same data when i creating PO using BAPI -> BAPI_PO_CREATE1 then i am getting following error E No instance of object type

  • LDAP and iPhone 3.0...?

    Has anyone been able to get iPhone 3.0 to work with Mac OS X server LDAP? Every time I search for a contact is says "Search Failed". The same settings work with Mac OS X address book, and my squirrel mail config. I wonder if this is a iPhone OS 3.0 b

  • Running a cycle count job in the background

    I am trying to set up a job to run in the background to create the inventory documents for the warehouse for a week.  The program is RLINV050 and I have a variant for the settings (this is a program that calls transaction LX26).  The problem is when

  • Delivery with WM Activated.

    Hi. How to do Picking when Warehouse management Activated??? What are the Tcodes??