Announcement

Collapse
No announcement yet.

How i can clear the Ram?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How i can clear the Ram?




    I have read various posts concerning the cleaning of the RAM with the mem_free() method but it does not work. Can you help me solve the problem?


  • #2
    Hi Eros,

    Can you provide me the code youre working on using the mem_free()?
    Please try to limit/remove any other unnecessary code or leave whatever is relevant to the issue.

    Comment


    • #3

      Okay, thanks for your time. Description: when I change "form" (it's a function) I want the memory to be reset each time. I am playing with the functions; I know that I am filling my memory every time, because the programm recreate the function, but I do not know how to do it. Example:


      func main()

      hndl := file_LoadImageControl("NoName1.dat", "NoName1.gci", 1);
      reply := Form2();

      endfunc

      func Form2()

      touch_Set(TOUCH_ENABLE);
      touch_DetectRegion(0, 0, 480, 270);

      if(touch_Get(TOUCH_STATUS) == TOUCH_PRESSED)
      gfx_Cls();
      mem_Free(hndl);
      reply := Form3();
      endif
      endfunc
      Last edited by Eros; 16th January 2018, 03:54 AM.

      Comment


      • #4
        Good day Eros,

        mem_Free() only frees the memory allocated by the function mem_Alloc(), mem_AllocV() or mem_AllocZ().
        Everytime the function goes back to the main function, the memory gets automatically freed.

        What does the Form3() function contain? This function recursion (form3 inside form2) may provide an EVE Stack error if uncontrolled efficiently.
        You may want to consider changing the structure of your code.

        Here is a sample code that may help you in function recursion:

        ViSi uCAM-II Demo for Picaso and Diablo16
        http://www.4dsystems.com.au/appnote/4D-AN-00114/

        Comment


        • #5
          I solved the problem by returning the functions in the main. Now there aren't stack problems. Thank you for the explanation and for your time!

          Comment

          Working...
          X