Memory leaks during child window close

Hi All,
   We have a tool that generates code for WPF application. In one of the applications WPF main window displays a child window in the form of a tab. The main window here can hold multiple child windows. I did a small test. I opened main window and
took memory snapshot with the help of .Net memory profiler. Opened child window and closed it immediately. I took snapshot again and compared with the previous one. To my surprise , many new objects/collections have been active in the heap and due to this
memory consumption got increased almost exponentially.  If I open and close more and more child windows then memory consumption is keep on increasing.
During child window close , I am performing all the clean up like clearing all collections , hashmaps etc. As per the suggestions mentioned in forums , I am taking care of cleaning up all the members data like DispatcherTimer , unregistering event handlers
etc. But still memory is not being freed up even after closing the child window. As per the profiler output most of the memory has been occupied by Hashtable , Hastable.bucket[]. Profiler even reported few pinned instances as well but it looks everything is
evident from framework API not from my code. I could see styles, controltemplates , System resources etc as active and reachable objects.
I am just wondering am I getting affected by framework flaws or could there be anything I can do in my source to get rid of this memory leak. Request your comment and appreciate your help on this.
Thanks,
Brahmaji.

Hi ,
 Thanks for the response. Basically I first opened parent panel which is of type Window. It included menu , toolbar etc. For menu/toolbar events it opens child windows which gets displayed in main window in the form of tabs. This is my use case.
I tried the suggested profiler Redgate Ants profiler. Its very good and informative! I ran the profiler
got the following output. Though I closed the child window it seems objects are still there in memory . No where I left out string , byte array objects in my code.
Not sure why Runtimemethodinfo , hastable bucket are there in memory. I even tried the workaround mentioned at here.
I thought panel resources might have not been freed up and in my code I am clearing them as well. Still did not see much improvement. Any additional things do I need to check? Please let me know.
Thanks,
Brahmaji.

Similar Messages

  • Memory leak during insert on PocketPC 2002

    We've built an application using an Oracle Lite 5.0.1 database using an ODBC interface. We've stolen most of the code from:
    C:\OraHome1\Mobile\Sdk\wince\samples\ODBC\sample.cpp
    We've found that there appears to be a memory leak during inserts (haven't fully analyzed updates/gets). The thing leaks roughly X bytes per insert where numBytesInInsertString < X < (2.5 * numBytesInInsertString)
    Has anyone else seen this? It becomes really apparent during out load from XML method where we walk through an xml document and perform roughly 7000 inserts in a row (commit at the end). The memory leak is not coming from the XML stuff, already tested for that.
    Paul Runstedler
    Intrexa Corp.

    I've went back to the sample to confirm my suspicions and sure enough there is memory being leaked. I loaded up the sample workspace in "[ORACLEHOME]\Mobile\Sdk\wince\samples\ODBC" and modified the sample.cpp code ever so slightly. Instead of performing one insert, one update and one select, it performs 5 iterations of 2000 inserts and skips over the updates and deletes. I've placed some memory reporting functionality after each iteration of inserts to report the free memory and this is what I get
    After Connection and creation of table Free: 19742720 Used: 8237056
    After iteration 1, 2000 inserts Free: 19439616 Used: 8540160
    After iteration 2, 2000 inserts Free: 19509248 Used: 8470528
    After iteration 3, 2000 inserts Free: 19439616 Used: 8540160
    After iteration 4, 2000 inserts Free: 19509248 Used: 8470528
    After iteration 5, 2000 inserts Free: 19283968 Used: 8695808
    After commit Free: 19283968 Used: 8695808
    As you can see, there is a loss of about 458700 bytes (about half a meg) over the 5 iterations. Thats about 46 bytes per insert. Not a lot for single insert, but this will eventually cripple any application that wants to perform a high number of inserts.
    Any help would be appreciated.
    Thanks,
    Paul Runstedler
    Intrexa Corp.
    PS: The following is the modified method in sample.cpp
    BOOL CSampleApp::InitInstance()
    COLiteDB db;
    MEMORYSTATUS memInfo;
    CString message;
    if (db.Connect())
    db.Execute (_T ("CREATE TABLE TT (COL1 VARCHAR2(40), COL2 VARCHAR2 (50))"));
    if (*db.GetError())
    AfxMessageBox (db.GetError());
    memInfo.dwLength = sizeof(memInfo);
    GlobalMemoryStatus(&memInfo);
    // Report memory usage
    message.Format( _T("After Connection and creation of table  Free: %d Used: %d\n"),
    memInfo.dwAvailPhys, (memInfo.dwTotalPhys - memInfo.dwAvailPhys));
    TRACE(message);
    CString insertString;
    for( int j = 0; j < 5; j ++ ) {
    for( int i = 0; i < 2000; i ++ ) {
    insertString.Format( _T("INSERT INTO TT VALUES (\'TESTINGTESTING123%d\', \'TEST2ANDBLAJHBLAJBLAJKBJAJAJAJAJJAJAJAJAJA\')") );
    db.Execute (insertString);
    if (*db.GetError()) {
    AfxMessageBox (db.GetError());
    memInfo.dwLength = sizeof(memInfo);
    GlobalMemoryStatus(&memInfo);
    // Report memory usage
    message.Format( _T("After iteration %ld, 2000 inserts  Free: %d Used: %d\n"),
    (j+1), memInfo.dwAvailPhys, (memInfo.dwTotalPhys - memInfo.dwAvailPhys));
    TRACE(message);
    #if 0
    db.Execute (_T ("UPDATE TT SET COL2 = 'TESTING ORACLE LITE' WHERE COL1='TEST1'"));
    if (*db.GetError())
    AfxMessageBox (db.GetError());
    CSQLResult* pres = db.Execute (_T ("SELECT * FROM TT"));
    if (pres != NULL)
    const CRowObj* pobj = pres->Fetch();
    while (pobj)
    CString str = (LPCTSTR)pobj->GetAt (0);
    str += TEXT (" ");
    str += (LPCTSTR)pobj->GetAt (1);
    AfxMessageBox (str);
    pobj = pres->Fetch();
    delete pres;
    #endif
    if( db.Commit() != TRUE ) {
    AfxMessageBox( _T("couldn't commit") );
    memInfo.dwLength = sizeof(memInfo);
    GlobalMemoryStatus(&memInfo);
    // Report memory usage
    message.Format( _T("After commit  Free: %d Used: %d\n"),
    memInfo.dwAvailPhys, (memInfo.dwTotalPhys - memInfo.dwAvailPhys));
    TRACE(message);
         // Since the dialog has been closed, return FALSE so that we exit the
         // application, rather than start the application's message pump.
         return FALSE;
    }

  • 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

  • Memory Leak During Spatial Query

    Platform:
    Oracle 8.1.7 EE with Spatial
    Windows NT 4.0
    I'm seeing a memory leak that I have determined has something to do with spatial. Here is the PL/SQL code that generates the leak:
    DECLARE
    v_id NUMBER(16);
    v_longitude NUMBER(15,10);
    v_latitude NUMBER(15,10);
    v_wirecenter_name VARCHAR2(11);
    CURSOR c_Source IS
    SELECT id, longitude, latitude
    FROM prospects_geocode_info;
    CURSOR c_WC IS
    SELECT wc.wirecenter_name
    FROM ion_info.ion_wirecenters wc
    WHERE mdsys.sdo_relate(wc.geoloc,
    mdsys.sdo_geometry(2001,
    8265,
    mdsys.sdo_point_type(v_longitude,
    v_latitude,
    NULL),
    NULL,
    NULL),
    'mask=contains querytype=window') = 'TRUE';
    BEGIN
    open c_Source;
    loop
    fetch c_Source into v_id, v_longitude, v_latitude;
    exit when c_Source%NOTFOUND;
    if v_longitude is not NULL and v_latitude is not NULL THEN
    open c_WC;
    loop
    fetch c_WC into v_wirecenter_name;
    exit when c_WC%NOTFOUND;
    end loop;
    close c_WC;
    end if;
    end loop;
    close c_Source;
    END;
    I'm attributing the link to spatial because if I change the c_WC cursor's SELECT statement to not use a spatial query, I get no leak. As near as I can tell I'm leaking a little bit of memory with each spatial query. I can watch the consumed memory jump in 64K blocks about every second or two on the machine I am running on.
    I have tried pinning the code in memory, as well as pinning the spatial index and it's table in memory. None of this helps. I am continuing to experiment with this, but wanted to see if anyone had any ideas.
    Thanks.
    Matt.

    I have been able to reproduce the memory leak now using a very simple anonymous PL/SQL block. All it is doing is looping through a range of lon/lat and issuing a given spatial query. Here it is:
    DECLARE
    v_longitude NUMBER(15,10) := 0;
    v_latitude NUMBER(15,10) := 0;
    v_miprinx NUMBER;
    v_lon_start NUMBER(15,10) := -150.0000000000;
    v_lon_end NUMBER(15,10) := -30.0000000000;
    v_lat_start NUMBER(15,10) := 20.0000000000;
    v_lat_end NUMBER(15,10) := 70.0000000000;
    CURSOR c_test IS
    SELECT mi_prinx
    FROM ion_info.ion_markets
    WHERE mdsys.sdo_relate(geoloc,
    mdsys.sdo_geometry(2001,
    8265,
    mdsys.sdo_point_type(v_longitude,
    v_latitude,
    NULL),
    NULL,
    NULL),
    'mask=contains querytype=window') = 'TRUE';
    BEGIN
    FOR v_longitude IN v_lon_start..v_lon_end LOOP
    FOR v_latitude IN v_lat_start .. v_lat_end LOOP
    OPEN c_test;
    LOOP
    FETCH c_test
    INTO v_miprinx;
    EXIT WHEN c_test%NOTFOUND;
    END LOOP;
    CLOSE c_test;
    END LOOP;
    END LOOP;
    END;
    On my 8.1.7 database on NT 4.0 I get the same results on all three tables that have spatial indexes. I tried this on a different spatial table on 8.1.6 on NT 4.0 and saw no memory leak. It doesn't matter whether I execute the script using sqlplus or sqlplusw.
    Matt.

  • Potential Memory Leak during Marshelling of a Web Service Response

    I believe I have found a memory leak when using the configuration below.
    The memory leak occurs when calling a web service. When the web service function is marshelling the response of the function call, an "500 Internal Server Error ... java.lang.OutOfMemoryError" is returned from OC4J. This error may be seen via the TCP Packet Monitor in JDeveloper.
    Unfortunately no exception dump is outputted to the OC4J log.
    Configuration:
    Windows 2000 with 1 gig ram
    JDeveloper 9.0.5.2 with JAX/RPC extension installed
    OC4J 10.0.3
    Sun JVM version 1.4.2_03-b02
    To demonstrate the error I created a simple web service and client. See below the client and web service function that demonstrates it.
    The web service is made up of a single function called "queryTestOutput".
    It returns an object of class "TestOutputQueryResult" which contains an int and an array.
    The function call accepts a one int input parameter which is used to vary the size of array in the returned object.
    For small int (less than 100). Web service function returns successfully.
    For larger int and depending on the size of memory configuration when OC4J is launched,
    the OutOfMemoryError is returned.
    The package "ws_issue.service" contains the web service.
    I used the Generate JAX-RPC proxy to build the client (found in package "ws_issue.client"). Package "types" was
    also created by Generate JAX-RPC proxy.
    To test the web service call execute the class runClient. Vary the int "atestValue" until error is returned.
    I have tried this with all three encodings: RPC/Encoded, RPC/Literal, Document/Literal. They have the
    same issue.
    The OutOfMemory Error is raised fairly consistently using the java settings -Xms386m -Xmx386m for OC4J when 750 is specified for the input parameter.
    I also noticed that when 600 is specified, the client seems to hang. According to the TCP Packet Monitor,
    the response is returned. But, the client seems unable to unmarshal the message.
    ** file runClient.java
    // -- this client is using Document/Literal
    package ws_issue.client;
    public class runClient
    public runClient()
    * @param args
    * Test out the web service
    * Play with the atestValue variable to until exception
    public static void main(String[] args)
    //runClient runClient = new runClient();
    long startTime;
    int atestValue = 1;
    atestValue = 2;
    //atestValue = 105; // last one to work with default memory settings in oc4j
    //atestValue = 106; // out of memory error as seen in TCP Packet Monitor
    // fails with default memory settings in oc4j
    //atestValue = 600; // hangs client (TCP Packet Monitor shows response)
    // when oc4j memory sessions are -Xms386m -Xmx386m
    atestValue = 750; // out of memory error as seen in TCP Packet Monitor
    // when oc4j memory sessions are -Xms386m -Xmx386m
    try
    startTime = System.currentTimeMillis();
    Ws_issueInterface ws = (Ws_issueInterface) (new Ws_issue_Impl().getWs_issueInterfacePort());
    System.out.println("Time to obtain port: " + (System.currentTimeMillis() - startTime) );
    // call the web service function
    startTime = System.currentTimeMillis();
    types.QueryTestOutputResponse qr = ws.queryTestOutput(new types.QueryTestOutput(atestValue));
    System.out.println("Time to call queryTestOutput: " + (System.currentTimeMillis() - startTime) );
    startTime = System.currentTimeMillis();
    types.TestOutputQueryResult r = qr.getResult();
    System.out.println("Time to call getresult: " + (System.currentTimeMillis() - startTime) );
    System.out.println("records returned: " + r.getRecordsReturned());
    for (int i = 0; i<atestValue; i++)
    types.TestOutput t = r.getTestOutputResults();
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file wsmain.java
    package ws_issue.service;
    import java.rmi.RemoteException;
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.server.ServiceLifecycle;
    public class wsmain implements ServiceLifecycle, ws_issueInterface
    public wsmain()
    public void init (Object p0) throws ServiceException
    public void destroy ()
    System.out.println("inside ws destroy");
    * create an element of the array with some hardcoded values
    private TestOutput createTestOutput(int cnt)
    TestOutput t = new TestOutput();
    t.setComments("here are some comments");
    t.setConfigRevisionNo("1");
    t.setItemNumber("123123123");
    t.setItemRevision("arev" + cnt);
    t.setTestGroup(cnt);
    t.setTestedItemNumber("123123123");
    t.setTestedItemRevision("arev" + cnt);
    t.setTestResult("testResult");
    t.setSoftwareVersion("version");
    t.setTestConditions("conditions");
    t.setStageName("world's a stage");
    t.setTestMode("Test");
    t.setTestName("test name");
    t.setUnitNumber("UnitNumber"+cnt);
    return t;
    * Web service function that is called
    * Create recCnt number of "records" to be returned
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException
    System.out.println("Inside web service function queryTestOutput");
    TestOutputQueryResult r = new TestOutputQueryResult();
    TestOutput TOArray[] = new TestOutput[recCnt];
    for (int i = 0; i< recCnt; i++)
    TOArray[i] = createTestOutput(i);
    r.setRecordsReturned(recCnt);
    r.setTestOutputResults(TOArray);
    System.out.println("End of web service function call");
    return r;
    * @param args
    public static void main(String[] args)
    wsmain wsmain = new wsmain();
    int aval = 5;
    try
    TestOutputQueryResult r = wsmain.queryTestOutput(aval);
    for (int i = 0; i<aval; i++)
    TestOutput t = r.getTestOutputResults()[i];
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file ws_issueInterface.java
    package ws_issue.service;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ws_issueInterface extends java.rmi.Remote
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException;
    ** file TestOutputQueryResult.java
    package ws_issue.service;
    public class TestOutputQueryResult
    private long recordsReturned;
    private TestOutput[] testOutputResults;
    public TestOutputQueryResult()
    public long getRecordsReturned()
    return recordsReturned;
    public void setRecordsReturned(long recordsReturned)
    this.recordsReturned = recordsReturned;
    public TestOutput[] getTestOutputResults()
    return testOutputResults;
    public void setTestOutputResults(TestOutput[] testOutputResults)
    this.testOutputResults = testOutputResults;
    ** file TestOutput.java
    package ws_issue.service;
    public class TestOutput
    private String itemNumber;
    private String itemRevision;
    private String configRevisionNo;
    private String testName;
    private String testConditions;
    private String stageName;
    private String testedItemNumber;
    private String testedItemRevision;
    private String unitNumber;
    private String testStation;
    private String testResult;
    private String softwareVersion;
    private String operatorID;
    private String testDate; // to be datetime
    private String comments;
    private int testGroup;
    private String testMode;
    public TestOutput()
    public String getComments()
    return comments;
    public void setComments(String comments)
    this.comments = comments;
    public String getConfigRevisionNo()
    return configRevisionNo;
    public void setConfigRevisionNo(String configRevisionNo)
    this.configRevisionNo = configRevisionNo;
    public String getItemNumber()
    return itemNumber;
    public void setItemNumber(String itemNumber)
    this.itemNumber = itemNumber;
    public String getItemRevision()
    return itemRevision;
    public void setItemRevision(String itemRevision)
    this.itemRevision = itemRevision;
    public String getOperatorID()
    return operatorID;
    public void setOperatorID(String operatorID)
    this.operatorID = operatorID;
    public String getSoftwareVersion()
    return softwareVersion;
    public void setSoftwareVersion(String softwareVersion)
    this.softwareVersion = softwareVersion;
    public String getStageName()
    return stageName;
    public void setStageName(String stageName)
    this.stageName = stageName;
    public String getTestConditions()
    return testConditions;
    public void setTestConditions(String testConditions)
    this.testConditions = testConditions;
    public String getTestDate()
    return testDate;
    public void setTestDate(String testDate)
    this.testDate = testDate;
    public String getTestName()
    return testName;
    public void setTestName(String testName)
    this.testName = testName;
    public String getTestResult()
    return testResult;
    public void setTestResult(String testResult)
    this.testResult = testResult;
    public String getTestStation()
    return testStation;
    public void setTestStation(String testStation)
    this.testStation = testStation;
    public String getTestedItemNumber()
    return testedItemNumber;
    public void setTestedItemNumber(String testedItemNumber)
    this.testedItemNumber = testedItemNumber;
    public String getTestedItemRevision()
    return testedItemRevision;
    public void setTestedItemRevision(String testedItemRevision)
    this.testedItemRevision = testedItemRevision;
    public String getUnitNumber()
    return unitNumber;
    public void setUnitNumber(String unitNumber)
    this.unitNumber = unitNumber;
    public int getTestGroup()
    return testGroup;
    public void setTestGroup(int testGroup)
    this.testGroup = testGroup;
    public String getTestMode()
    return testMode;
    public void setTestMode(String testMode)
    this.testMode = testMode;

    I use web services a lot and I sympathize with your issue. I
    struggle with similar issues and I found this great utility that
    will help you confirm if your webservice is returning the data
    correctly to Flex. I know you said it works in other applications
    but who knows if flex is calling it correctly etc. This utility is
    been the most amazing tool in helping me resolve web service
    issues.
    http://www.charlesproxy.com/
    Once you can confirm the data being returned is good you can
    try several things in flex. Try changing your result format to
    object or e4x etc. See how that plays out. Not sure where your
    tapping in to look at your debugger, you might want to catch it
    right at the result handler before converting to any collections. .
    If nothing here helps maybe post some code to look at. .
    .

  • Memory leak during copyPixels

    Hi,
    I am making a custom renderer using the copyPixels function for my
    Haxe/Flash game. So I have this kind of code :
    buffer.bitmapData.copyPixels(m_CurrentSkin, RECT3, POINT, null, null,
    true);
    where :
    -buffer is the bitmap where all my scene's objects are drawn
    -m_CurrentSkinis the BitmapData that contains the current frame of the
    object to be drawn
    Every time m_CurrentSkin contains a BitmapData that have never been
    drawn (the first time that an animation frame is drawn for example), I
    have a memory leak that is not garbage.
    However if m_CurrentSkin contains a BitmapData that have already been
    drawn (when the animation is played a second time for example), there
    isn't any memory leak.
    If I comment this line there is no leak so the problem comes from
    there.
    It seems that a copy of the BitmapData is cached in memory but I have
    checked in my code and there is no cacheAsBitmap explicitely set to
    true.
    Anyone have idea of what is happening?
    Thank you,
    Régis.

    How do you know it's leaking? As I copyPixels and watch the profile in FlashBuilder I see flash caching and it doesn't garbage collect until it feels it's necessary. If it continuously acceesses the same thing it's not behaving improper to continuously keep it in cache.
    That being said, if you press the manual garbage collection button and don't see it release within a few seconds, it might be a leak. The only way you'll really know is to isolate this, clear the bitmapdata objects and null them out while pressing garbage collection to see if flash properly disposes of the bitmapdata instances. Just make sure you're disposing of them properly.

  • Memory Leak during EAR stop/update/start

    Hi all,
    Excuse me if I'm putting this question in the wrong forum - not sure if it should be here or "EJB". That being said - I am working on a project which is using Weblogic 11g and we have a set of EARs with EJBs deployed out. In one EJB we have a static variable which holds onto an object which is rather large (~2 Gigs).
    What I've noticed is that if I stop the EAR containing that EJB, update and restart it without restarting the server it's running on, the memory of that object does not seem to get GC'd. So basically, every time we make changes to that EAR and want to deploy we end up eating up a lot of memory.
    Our current way to fix this is to add a @pre-destroy method which basically does a "largeObject = null". This seems to allow it to be marked and collected by the Garbage Collector. However, I don't think this is the best solution for all static objects (what happens if we have an a bunch of EJBs in the pool and the AppContainer destroys one - all static references will get removed right?).
    Is there a reason that the AppContainer is holding on to those static references? Or am I missing something?
    Thanks,
    -Ritter

    An object referenced by a static member variable is strongly referenced until the class is unloaded. A normal classloader
    never unloads a class, but on an application server, such as WebLogic, this sometimes happens under the right conditions.
    A class in Java can be garbage-collected when nothing references it. In most simple setups this never happens, but there are situations where it can occur.
    There are many ways to make a class reachable and thus prevent it from being eligible for GC:
    - objects of that class are still reachable.
    - the Class object representing the class is still reachable
    - the ClassLoader that loaded the class is still reachable
    - other classes loaded by the ClassLoader are still reachable
    When none of those are true, then the ClassLoader together with all classes it loaded are eligible for GC.
    The best way to proceed is not to use global variables (which is asking for tricky memory leaks), especially ones that are 2G.

  • Firefox, huge memory leak, it doesn't close.

    I have this problem with firefox: if I run it
    and I don't do anything, the process memory keeps growing.
    Anyway memory keeps growing whatever you do. If you try
    to close the browser the window disappears but
    the process don't close and you have to kill it.
    Anyway, if you ignore the problem firefox "eats"
    all the system memory (4gb).
    Anybody else has the same problem?
    PS: My system is up to date.
    Last edited by saronno (2014-11-29 18:47:37)

    I'm having the exact same issue but the only difference is that this doesn't happen when firefox does nothing, it only happens when I open up a new tab and it's quite random; So far, this happened majorly on flash-related pages but this wasn't a problem until the recent Firefox update. So I don't think this is a flash-related problem; Since with shumway it does the exact same thing, randomly.
    Last edited by anarchticgrimm (2014-10-30 18:11:33)

  • Memory leak with Visa Close in loop

    I read the other posts about the memory leak problems with Visa Close, but eliminating the Visa Close from VI causes problems with read & write (it seems to go out of sync). Any suggestions? Example attached.
    Attachments:
    MKS_651C_Serial_Communication.vi ‏144 KB

    Solved the problem. I had to change the bit count and adjust sort. Removing the Visa Close did eliminate the memory leak.

  • App-V 5.0 memory leak problem & slow program launch

    App-V 5 clients with most recent updates have a memory leak problem. Windows 7 64bit workstations with 8GB of memory will be useless within couple of days because memory has run out. Terminating App-V client process will free the memory, but system starts
    to consume it again after that. All hotfixes (up to 5) have been installed.
    Another problem is that launching some large (locally cached) programs, for example SolidWorks, takes many minutes for a program to start. With 4.6 there wasn't any performance issues.
    Any suggestions?

    I saw the exact same issue with slow load times and 50% utilization by AppVClient.exe during that time.
    AppV 5 first launch application performance
    AppV 5 - Measuring RegistryStaging load times
    The issue, specifically, is the amount of time the application takes to stage the registry is what causes the slow load and 50% CPU utilization.  I've written a script that stages the registry on your behalf that we use on server startup, after all
    the packages are loaded.
    Original Thread on MS forums:
    https://social.technet.microsoft.com/Forums/en-US/44944302-d8f3-4df1-b104-9c63345f88e0/poor-first-launch-performance-with-appv-5?forum=mdopappv

  • Memory Leak in Adobe Premiere CC on Windows

    I installed Premiere CC on Windows 7 ( Intel Core i7-3770K [email protected] GHz, 16GB RAM). Software has a serious memory leak. After less than hour working on a very simple project (no rendering, no effects) memory usage  reached 15 GB, at which point Premiere stopped responding. After closing and reopening software memory usage again started to increase. I was testing it by just scrubbing over timeline, no editing, memory usage still slowly crept-up. I called Adobe technical support, they tried to tell me, that this is normal. Right! It is normal to be forced to close and reopen application every hour? I do not think so. I have Premiere CC also installed on my MAC Book Pro, checked memory usage on much bigger project, it was steady, not creeping up, using beween 1 and 2 GB.  I checked forums for this problem, there are several posts, but have not found any response from Adobe regarding this.
    Update:
    Tonight I continued working on same small project, within 2 hours I had to shut down Premiere 3 times. I also limited in setting memory Premier can use, that did not make any difference, usage by Premiere went to maximum - total 16 GB with about 2 GB taken by system and other stuff running. I am monitoring memory usage on resource monitor. Used Physical memory went 100 %, Commit Charge about 60%. This so far happened three times  in a row.
    Adobe, can you hear me?
    Milan
    Message was edited by: milan-to
    Message was edited by: milan-to

    Adobe, can you hear me?
    Not guaranteed when posting here.  Try below instead.
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Having said that, this is not a problem I see on any of the four Windows machines I work on.  And it's not a problem commonly reported here.  So my inclination is to suggest that something may be funky with your install.

  • Media Encoder is a memory leak - windows

    Applies to: Version 5.5.1.12 - 64 bit, Windows (Most likely earlier versions too)
    Reproducing the problem:
    Start Media Encoder as a standalone application by double clicking the icon.
    Close the window (by clicking the 'x' in the top-right corner) of Media Encoder.
    It does just that: closes the window. It does not close the process.
    The process now has no window-handle, thus the user can not access it.
    When user starts the application again, another process is created.
    Thus the previous process becomes a memory leak.
    Workaround:
    Open Windows Task Manager by pressing Ctrl-Alt-Del keys simultaniously then selecting Task Manager
    Click the 'Processes' tab
    Highlight 'Adobe Media Encoder.exe'
    Click 'End Process'
    Ignore the warning and kill the process

    Bill, Sometimes it takes AME and related components up to 30 seconds to close various processes.  If you close the app and immediately start a new instance, the old process sees that AME is still running and may not shut down it's process until you shut down your computer.  So give it a little time after shutdown to see if that helps.  That said, there are situations that I have seen myself that AME would not close all processes in background.  In many of those cases, it had to do with dynamic link and what type of files or assets you opend up and what application launches AME.  Sometimes when AME is launched by other applications like Premiere Pro, it leaves a process alive in case PPro is using it. but if you close all Adobe apps, it should close your process as well. Over the past few cycles, we have worked on improving processes. Let me know if the above info doesn't help.

  • Windows Audio Device Graph Isolation [audiodg.exe] MEMORY LEAK - EATS OUT 60-85% of CPU

    Hello,
    I've updated, 2 days ago, from Win 8 to Win 8.1 Pro and this memory leak problem that has occurred to me previously in other Win versions has arrived again. Didn't upgrade from boot, just from the desktop. Cleaned up the previous Windows installations and all
    that jazz that was inherent to Windows updates. Tried to fix this problem with the normal method of disabling the enhancements at the playback device but they are gone.
    My drivers are all up to date and have a Conexant SmartAudio HD sound platform. 
    Thanks in advance for any sort of help.

    I maybe got a solution for this... (Worked for me)
    I
    Right-click the speaker icon in the lower right corner.
    Select Playback Devices from the menu. A list of devices should appear on the screen.
    Double-click the device that has a green checkmark. The properties windows for that device should open.
    Click the Enhancements tab at the top.
    From the list of enhancements, uncheck all of them, or click the Disable all enhancements checkbox.
    Click the OK button to save your changes and close the window.
    Click OK to close the Playback Devices window.
    Please reply if that helped you :-)

  • How to fix huge iTunes memory leak in 64-bit Windows 7?

    iTunes likes to allocate as much as 1.6GB of memory on my dual-quad XEON 8GB 64-Bit Windows computer and then becomes unresponsive.
    This can happen several times a day and has been going on for as long as I can remember.  No other software that I use does this - only Apple's iTunes.  Each version I have installed of iTunes appears to have this same memory leak.  Currently I am running version 10.7.0.21.
    I love iTunes when it works.  But having to constantly kill and relaunch the app throughout the day is bringing me down.
    Searching for a fix for this on the internet just surfaces more and more complaints about this problem - but without a solution.
    Having written shrinkwrapped software for end users as well as for large corporations and governments for more than 25 years I know a thing or two about software.  A leak like this should take no more than a day or two to locate using modern software tools and double that to fix it.  So why with each new version of iTunes does this problem persist?  iTunes for Windows is the flagship software product Apple makes for non-Mac users - yet they continue to pass up each opportunity they have had over the years with each new release to fix this issue.  Why is this?
    Either the software engineers are not that good or they have been told NOT to spend time on this issue.  I personally believe that the engineers at Apple are very good, and therefore am left thinking that the latter is more likely the case.  Maybe this is to coax people to purchase a Mac so that they can finally run iTunes without these egregious memory leaks.  I would like to offer another issue to consider.
    Just as Amazon sold Kindles and Google sold Nexus tablets at low cost - not counting on margin for profit - but instead they wanted to saturate the marketplace with tools for making future purchases of content almost trivial to do with their devices.  Apple also counts on this model with their pricer hardware - but they also have iTunes.  Instead of trying to get people to switch to a MAC by continuing to avoid fixing this glaring issue in iTunes for Windows I would like to suggest that by allowing their engineers to address this issue that Apple will help keep Windows users from jumping ship to another music app.  The profit to be made by keeping those Windows users happy and wedded to the iTunes store is obvious.
    By continuing to keep this leak in iTunes for Windows all it does is lower my esteem for the company and start to make me wonder if the software is just as buggy on Macs.

    I have same issue. Ongoing for more than 1 year and currently running iTunes 11.3.
    My PC is Dell OptiPlex 990 I7 processor, 8GB ram, W7 64 [always keep things patched up to latest OS updates etc]
    I use this iTunes install to stream music videos etc to multiple appleTVs, ipads, iphones etc .. via Home Sharing
    Store all my media including music, videos and apps on separate NAS  .. so the iTunes running on PC is only doing the traffic cop role and streaming / using files stored on NAS .. creates lots of IO across my network
    Previous troubleshooting suggest possible contributing causes include
    a) podcast updates  .. until recently I had this auto updates on multiple podcast subscriptions, presumably the iTunes would flow this from the PC to save on the NAS across the network .. if the memory leak is in the iTunes network communication layer (?bonjour?)  this may be sensitive to IO that would not normally occur if the iTunes file saving was local on the same PC
    b) app updates .. have 200+ apps in my library and there is always a batch of updates .. some updates 100s of MB is size .. routinely see 500MB to 1GB of updates in single update run .. all my apps are
    c) streaming music / movies .. seems when we ramp up streamlining of music or movies . memory leak grows faster .. ie within hours of clean start
    c) large syncs of music or videos to ipads or iphones .. noticed that get big problems when I rebuild an ipad .. I typically have 60+ GB of data in terms of apps /  music / videos to load .. have to do rebuild in phases due to periodic lockups

  • Memory Leak using CertOpenStore on Windows 2008 R2

    I have a program (runs both 32 and 64 bit ) that when using CertOpenStore results in a memory leak on Windows 2008 R2 only (I haven't tried 2012, but this code has run for years on 2000, 2003, 2008 without issues)
    Sample code to reproduce the issue:
    int main( int argc, char** argv )
    HCERTSTORE store;
    int go = 1;
    while( go ){
    store = CertOpenStore(
    CERT_STORE_PROV_SYSTEM_A,
    0,
    0,
    CERT_SYSTEM_STORE_LOCAL_MACHINE | CERT_STORE_OPEN_EXISTING_FLAG,
    "MY" );
    if( store ){
    //if( !CertCloseStore( store , CERT_CLOSE_STORE_CHECK_FLAG ) ){
    if( !CertCloseStore( store , CERT_CLOSE_STORE_FORCE_FLAG ) ){
    if( GetLastError() == CRYPT_E_PENDING_CLOSE ){
    printf( "!" );
    else{
    go = 0;
    else{
    go = 0;
    Sleep( 10 );
    return 0;
    The callstack for allocations pretty much are all like this  (this is from a 32 bit process on a 2008R2 box)
          HEAP_ENTRY Size Prev Flags    UserPtr UserSize - state
            02e75af0 000f 0000  [00]   02e75b08    0005e - (busy)
            7724dff2 ntdll!RtlAllocateHeap+0x00000274
            745f6017 AcLayers!malloc+0x00000079
            7460dc96 AcLayers!NS_VirtualRegistry::MakePath+0x00000056
            7460e817 AcLayers!NS_VirtualRegistry::CVirtualRegistry::OpenKeyW+0x000000a9
            7460f21a AcLayers!NS_VirtualRegistry::APIHook_RegOpenKeyExW+0x00000036
            743d2641 AcGenral!NS_WRPMitigation::APIHook_RegOpenKeyExW+0x00000024
            7527a246 crypt32!RegOpenHKCUKeyExU+0x00000055
            7527de26 crypt32!OpenSubKeyEx+0x00000108
            7527e4d8 crypt32!OpenSubKey+0x00000015
            7527ed88 crypt32!OpenSystemRegPathKey+0x00000033
            75281a2f crypt32!EnumPhysicalStore+0x00000162
            75281d0e crypt32!I_CertDllOpenSystemStoreProvW+0x0000015c
            752c9fce crypt32!I_CertDllOpenSystemStoreProvA+0x0000006c
            7527e49a crypt32!CertOpenStore+0x0000010e
    Anyone have any ideas of a hotfix available for this?
    thanks

    Might ask them here about this.
    Windows Desktop Dev forums on MSDN
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

Maybe you are looking for

  • Digital Signatures for PMO

    Dear All,             Could you please explain me the Digital Signature Configuration steps for Document Systems for Solar02 ? Could you please share me the documents regarding this? Regards, Krishnan Kumar.K SolMan Consultant +91-9036197602

  • Error in Executing Web Interface

    Hi, I have created a Web Interface named "ZROLLHOSKEL". It is working fine in Development system. But when i run it in Production system(in Web Browser), I am getting following Error: Business Server Page (BSP) error What happened? Calling the BSP pa

  • Does anyone know if a cable exists that would connect Airport Express to a Sony DMport connection?

    I have a Sony home cinema amp and the only unused connection is a DMport. I have googled, but can't seem to get a definative answer. Can anyone help?

  • Re: Email problems

    hi since moving over to the new bt email,at least one in every 10 emails cant be read,i get "read error" an error occurred while reading email-generic error,what can i do?

  • Corrupt events photo on ipad

    Recently I upgraded my ipad to ios 5.1. Then my events photo has strange. They have empty photo in each event. Event name are 103MPRT, 104MPRT to 176MPRT all of events can't remove or delete.