On Mon, 29 Jun 2015, Andi Jahja wrote:

Hi,

> Hello,
> I randomly get this error message:
>    "WITH OBJECT excessive nesting!"
> As per default build, HB_MAX_WITH_OBJECT is preset to 64.
> But I am very sure that my application does not have that much nests.
> This occurs when I repeatedly execute sub function containing WITH OBJECT.
> I suspect the counter is not released after a nest reached an "END"
> Anyone?

After short checking current HVM code in xHarbour I can see two possible
reasons:

1. You are using recursion.
   Due to limitation in xHarbour implementation FOR EACH and WITH OBJECT
   cannot be used in algorithms using recursion because they can reach
   HB_MAX_WITH_OBJECTS or HB_MAX_ENUMERATIONS limits.
   It's very serious problem I reported nearly 10 years ago.
   To resolve it it's necessary to redesign FOR EACH and WITH OBJECT
   implementation in xHarbour. It would be nice to also eliminate
   overhead caused by current code. Even if programmer does not use
   above constructions then HVM in xHarbour executes additional code
   to initialize and finally clean FOR EACH and WITH OBJECT counters
   and containers on each PRG function call what reduces overall
   performance. The implementation in Harbour does not have such
   problems so it can be taken as base.

2. Looks that code executed for -gc3 output does not restore FOR EACH
   and WITH OBJECT counters. Such additional cleanup it's yet another
   overhead in current implementation which can be eliminated new one.
   Example below illustrates it:

         #include "hbclass.ch"
         proc main()
            local i
            for i := 1 to 100
               begin sequence
                  with object i
                     if i < 100
                        break
                     endif
                  end with
               endsequence
            next
         return

   This can be easy fixed anyhow I strongly suggest to start deeper
   modifications which resolved also other problems.

best regards,
Przemek

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to