Bigtext Memory Leak

kriki
kriki Member, Moderator Posts: 9,121
If you use a bigtext in a function (or a codeunit) and you call that function (or codeunit) a lot of times, Navision doesn't free the memory for it. Not even with a CLEAR of the variable.
In the taskmanager I notice that the Navision client (or NAS) takes a huge amount of memory.
So the only way I found is to close Navision and restart.

I also have had the strange event that the taskmanager reports that a lot of memory is in use, but in the processes-list I don't find the process who has eaten the memory (even if I know it is Navision and closing Navision doesn't even free the memory).

I have also noticed that 5.0 has the same problem.

Someone has some better trick to avoid this memory loss?
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Comments

  • ara3n
    ara3n Member Posts: 9,258
    you could avoid using big text and use blob instead.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kriki
    kriki Member, Moderator Posts: 9,121
    But on those, I cannot use the text-functions (STRPOS,GETSUBTEXT).

    I was already thinking about an array [1..1000] of Text 1000 and program all operations I need....
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3n
    ara3n Member Posts: 9,258
    You could implement textPOS and GETSUBTEXT with blob as well.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • nunomaia
    nunomaia Member Posts: 1,153
    Bigtext in Navision it’s a feature that has never well implemented.
    It’s a feature that I always try to avoid.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • kriki
    kriki Member, Moderator Posts: 9,121
    ara3n wrote:
    You could implement textPOS and GETSUBTEXT with blob as well.
    I was more thinking about using temptables to do this.

    To be honest, I don't see how to do it with a blob. Or do you mean with streaming it in text variables?.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3n
    ara3n Member Posts: 9,258
    Yes. converting it to text variable
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Lin
    Lin Member Posts: 40
    If your bigtext is defined as Local change it to Global that sometimes helps with memory leaks.
  • kriki
    kriki Member, Moderator Posts: 9,121
    Lin wrote:
    If your bigtext is defined as Local change it to Global that sometimes helps with memory leaks.
    That was the first thing I wanted to try. Because it is something I can do quite quickly.
    And if it doesn't help enough. I program a temptable to simulate bigtexts.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Solmyr
    Solmyr Member Posts: 51
    I faced with the same error, but CLEAR(BigText) was solution in my case.
    I've tested it on NAV 4,5,6 and the behaviour is same. If CLEAR(BigText) is missed, memory is leaking.

    Code example:
    FOR j := 1 TO 300 DO BEGIN
      InFile.OPEN('C:\temp\metadata.xml');
    
      InFile.CREATEINSTREAM(InStr);
      BigTxt.READ(InStr);
      i := 1;
      TextLenght := BigTxt.LENGTH;
      WHILE i <= BigTxt.LENGTH DO BEGIN
        TextLine := '';
        BigTxt.GETSUBTEXT(TextLine,i,1024);
        i := i + 1024;
      END;
      InFile.CLOSE;
      CLEAR(BigTxt);
    END;
    
    
    Oleg Dovgalenko
  • frankdynamic
    frankdynamic Member Posts: 11
    See KB 2728774, 2735461, 2736891