RobotStudio event

dispose problem

Options

hello all,

i am checking my program by console window for memory leaks. I encounter the following problems :

1. When i open my app from ABB menu, and i close it, memory regains ok, but if i open my app a second time and close it, memory don't regain.   it looks like the dispose is not run, because i have added a console.writeline to it, is is displayed the first time, not the second one
Anybody an idea?

2.when i look at the memory in console window, it is decreasing even when i never started my app, with 4096 every 10-20 seconds or so. rapid is not running at this moment, robot is in manual and motors not on.
is this normal beheaviour?

Comments

  • carlosmtz2000
    Options

    Hi Peter,

    1. What information are you writting in the console: the memory or a line written in a Dispose method?

    2. Do you have another UI opened?

    BR/C

    Carlos Martinez
    ABB
  • kioog
    Options

    1. i just write console.writeline("disposed everything").

    2. no, no other gui opened

  • kioog
    Options
    i look at the memory usage by the console port on irc5 and using hyperterminal
    fpcmd_enable_console_output 3
    period 3,fpcmd,"-memshow"
  • carlosmtz2000
    Options

    - In which classes are you writting this line: UI Controls or other classes? The UI controls are disposed after pressing the Close button; all other classes either the disposed is called manually or let the garbage collector (GC) handles this. The GC is called randomly so it is hard to measure this.

    - Do you have a connection to the controller in the UI?

    Carlos Martinez
    ABB
  • kioog
    Options
    i use my laptop pc to connect with hyperterminal to irc5 controller for console window
  • carlosmtz2000
    Options

    Hola Peter,

    I was referring to your TpsView application, if inside your application there are connections and subscriptions to the IRC5?

    Even though, I re-read your problem description and you are saying that the memory is decreasing even though no Tps Application is opened. This is not the normal behavior, but we need to monitor if the memory will be released after a while (this means, whenever the GC decides that is time to go and release memory).

    Carlos Martinez
    ABB
  • carlosmtz2000
    Options

    just to be more specific ... the GC will not call the dispose method, it will ony release the memory used by the class that is released.

    Carlos Martinez
    ABB
  • kioog
    Options

    i use the normal dispose :


    public TpsViewIRC5App13()

    {

    //

    // Required for Windows Form Designer support

    //

    InitializeComponent();

    //

    // ToDo: Add any constructor code after InitializeComponent call

    //

    }

    /// <summary>

    /// This is where you clean up any remaining resources used by your application before

    /// the application itself is disposed of by TAF (TeachPendant Application Framework).

    /// The method is called by TAF when the application is closed down.

    /// </summary>

    protected override void Dispose(bool disposing)

    {

    if (!IsDisposed)

    {

    //try

    //{

    if (disposing)

    {

    //ToDo: Call the Dispose method of all FP SDK instances that may otherwise cause memory leak

    .............

    in here i write all the dispose commands.
    As i said, it is working the first time when i close my app, but if i reopen my app and close it again, it won't release the memory

     

  • kioog
    Options

    at the end of dispose routine i write :

    base.Dispose(disposing);

    Console.WriteLine("disposed everything");

    i get the message the first time, not the second one, so i guess the routine is not called

  • carlosmtz2000
    Options

    This is quite strange. I made a simple and and every time, after pressing the Close button, my message box is displayed.

    In your Dispose method, do you have more code that could cause an exception? Have you try to put your WriteLine at the beginning of the method?

    2008-08-13_005330_view.zip

    Carlos Martinez
    ABB