Hello,

AFL engine has separate heap that is entirely freed and destoryed (HeapDestroy) after AFL formula execution ends
so entire memory is given back to Windows.

Best regards,
Tomasz Janeczko
amibroker.com

On 2010-04-02 15:08, Paul Ho wrote:


tomasz
just a follow up question on gSite.Free(). does ab always return memory to the heap space, or does ab cache/manage the free memory itself?

On Fri, Apr 2, 2010 at 9:49 PM, Tomasz Janeczko <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    If you do not return them from inside of the function, you should
    free
    them using gSite.Free().
    If you forget to do that, they will still be freed automatically
    at the
    end of formula execution.

    Generally speaking everything is freed at the end of formula
    execution
    (with the exeception to static variables).



    Best regards,
    Tomasz Janeczko
    amibroker.com <http://amibroker.com/>

    On 2010-04-02 12:38, WiseStockTrader wrote:
    > Hi Tomasz, thanks for the quick reply. If the dll function uses
    gSite.AllocArrayResult(); to create arrays for internal
    computations does that also get freed? Or should i allocate that
    memory myself and free it before the function returns?
    >
    > --- In [email protected]
    <mailto:amibroker%40yahoogroups.com>, Tomasz Janeczko<gro...@...>
    wrote:
    >
    >> Hello,
    >>
    >> All memory allocated by AllocArrayResult is automatically freed.
    >>
    >> The exact moment when it is done depends on how value is used.
    >> For example
    >>
    >> array = YourDLLFunction(); // inside this function array is
    allocated
    >>
    >> x = array * 2;
    >> // the memory is still allocated here because array variable
    still holds it
    >>
    >> array = 2 * x; // at this point memory allocated by your
    function is
    >> freed because array variable no longer references it (new value is
    >> assigned to array)
    >>
    >>
    >> At worst memory will be allocated at the end of given formula
    execution.
    >>
    >> Best regards,
    >> Tomasz Janeczko
    >> amibroker.com <http://amibroker.com/>
    >>
    >> On 2010-04-02 11:45, WiseStockTrader wrote:
    >>
    >>> Hello
    >>>
    >>> Does anyone know if all memory allocated via
    gSite.AllocArrayResult();
    >>> is freed automatically at the end of the dll function call via
    AFL? I hope Tomasz could answer this for me.
    >>>
    >>>
    >>>
    >>> ------------------------------------
    >>>
    >>> **** IMPORTANT PLEASE READ ****
    >>> This group is for the discussion between users only.
    >>> This is *NOT* technical support channel.
    >>>
    >>> TO GET TECHNICAL SUPPORT send an e-mail directly to
    >>> SUPPORT {at} amibroker.com <http://amibroker.com/>
    >>>
    >>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
    >>> http://www.amibroker.com/feedback/
    >>> (submissions sent via other channels won't be considered)
    >>>
    >>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
    >>> http://www.amibroker.com/devlog/
    >>>
    >>> Yahoo! Groups Links
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>
    >
    >
    >
    > ------------------------------------
    >
    > **** IMPORTANT PLEASE READ ****
    > This group is for the discussion between users only.
    > This is *NOT* technical support channel.
    >
    > TO GET TECHNICAL SUPPORT send an e-mail directly to
    > SUPPORT {at} amibroker.com <http://amibroker.com/>
    >
    > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
    > http://www.amibroker.com/feedback/
    > (submissions sent via other channels won't be considered)
    >
    > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
    > http://www.amibroker.com/devlog/
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >





Reply via email to