Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10389

Re: SetMaxDynSpace blues

From "Jamal" <noooospam@example.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: SetMaxDynSpace blues
Date 2017-04-06 10:49 -0400
Organization albasani.net
Message-ID <oc5kh1$3dq$1@news.albasani.net> (permalink)
References <d41d3ab4.0403291059.47257ac4@posting.google.com> <f05a8991-18c1-4143-9ab2-172bf9bd8b17@googlegroups.com>

Show all headers | View raw


Robert,

I see you are skipping in the loop.

Try adding the following around the loop to avoid the extra overhead when 
updating the dbServer.
This also avoids issues if a primary index key is updated, because record 
pointers may change and the skip operation may not be on the correct row 
(record).

oServer:SuspendNotification()

// your fieldput loop

oServer:ResetNotification


HTH,
Jamal

"Robert Pope"  wrote in message 
news:f05a8991-18c1-4143-9ab2-172bf9bd8b17@googlegroups.com...

On Tuesday, March 30, 2004 at 5:59:10 AM UTC+11, Ameer Hussein wrote:
> Hi,
>
> I encountered a serious issue while 'porting' a large project from VO
> 2.6 to Vo 2.7. The problem I found is related to SetMaxDynSpace:
>
> Here's the test case:(basic console app)
> ==============================================================
> FUNCTION Start(p)
> LOCAL oCon AS Console
> LOCAL count :=0 AS INT
> LOCAL cThis AS STRING
>
> SetMaxDynSize(128*1024*1024) // 128 MB
>
> oCon := Console{}
>
> /*1*/ DynLock()
>
> WHILE TRUE
> Count++
> IF Mod(COUNT,64)==0
> oCon:WriteLine("dING ...."+Str(COUNT)+"........"+Str
> (DynInfoUsed()))
> ENDIF
> /*2*/ cThis:=Space(64*1024) // 64 KB string
> ENDDO
>
> RETURN
> ========================================================
> The code attempts to use up dynamic memory eventually crashing the
> program. The line marked /*1*/ locks dynamic memory so that GC is not
> triggered, and the line marked /*2*/ allocated 64 KB strings. Since GC
> is never triggered, strings allocated for cThis in previous loop
> iterations are never freed and dynamic memory gets used up.
>
> The program crashes while DynInfoUsed returns 32 MB although dynamic
> memory size is set to 128 MB as you can see in the beginning of the
> function!
>
> Now, take this code to VO 26, remove the call to SetMaxDynSize and fix
> your CA-Visual Objects/RunTime registery entry  to use 128 MB Dynamic
> memory and the code will run correctly, breaking  when DynInfoUsed
> returns around 128 MB. (vo 26 also seemed as if it did some garbage
> collection although dynlock was in effect!!!)
>
> Playing with the value passed to SetMaxDynSize does not change VO 27
> behavior in anway! It's as if the call is completely ignored.
>
> The application I was porting to 27 does run with only  32 MB  of
> dynamic memory but performance suffers, and setting dynamic memory
> size to 64 MB or 128 MB if the machine can  take the load allows users
> to open many more data windows without running into memory related
> issues. I'll have to postpone the upgrade until the issue is solved.
>
> Any Ideas, workaround untill 2.7 patch comes up?

Bumping this thread because it was useful in identifying an issue in our 
app. We were getting FIELDPUT (occasionally 5333) errors on a very basic 
loop, the code was essentially as follows:

LOCAL oServer AS DBServer

DO WHILE .NOT. oServer:EoF
   oServer:FIELD := 0 // 30 more lines like this, all setting zero to a 
float
   oServer:Skip()
END DO
oServer:Commit()

This was the most common error:

***********************ERROR********************************
Visual Objects (Version 2.8. Build 3.2838), Version 2.8 SP4b
2017-04-06 15:40:51
Application: ...

Error message:
--------------
Error Code:  30 [ OPERATION NOT SUPPORTED ]
Subsystem: BASE
Operation: <=, Arg:          0, Type: LONGINT
Function: FIELDPUT
Argument:                             17
Type: LONGINT
Argument Number: 2
Requested type: UNKNOWN
CallStack:
MYDBFSERVER:FIELDPUT (Line:33) (This calls DBServer:FIELDPUT)
MYTABLE:DAY:ASSIGN (Line:2)

Error Object created:
--------------------
SubSystem       :BASE
SubCode         :0
GenCode         :Operation not supported
OsCode          :0
ArgType         :LONGINT
FuncPtr         :0x0002EE5E
ArgNum          :2
FuncSym         :FIELDPUT
Severity        :0
CanDefault      :.F.
CanRetry        :.F.
CanSubstitute   :.T.
Operation       :<=, Arg:          0, Type: LONGINT
Description     :
FileName        :
Tries           :0
FileHandle      :0
SubCodeText     :
Arg             :                            17
ArgTypeReq      :UNKNOWN
MaxSize         :0
SubstituteType  :LOGIC
CallFuncSym     :
--------------------

Reading through other threads, we put DynLock() and DynUnlock() around the 
loop, which stopped the error was but wasn't a practical solution.

Putting a CollectForced() prior to the Skip() caused the app to crash on the 
first loop.

We had the following two lines in our FUNCTION Start(). This was also a 
console app - which is something in common with the parent. Commenting out 
those two lines made the error disappear. Even if I keep the CollectForced() 
in the loop, it still works as expected.

// SetMaxDynSize(128*1024*1024) // 128 MB
// DynSize(200)

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: SetMaxDynSpace blues Robert Pope <cooeee@gmail.com> - 2017-04-05 23:49 -0700
  Re: SetMaxDynSpace blues Otto Christiaanse <ofchristiaanse@gmail.com> - 2017-04-06 05:30 -0700
    Re: SetMaxDynSpace blues Robert Pope <cooeee@gmail.com> - 2017-04-07 01:48 -0700
  Re: SetMaxDynSpace blues "Jamal" <noooospam@example.com> - 2017-04-06 10:49 -0400
    Re: SetMaxDynSpace blues Robert Pope <cooeee@gmail.com> - 2017-04-07 01:52 -0700
      Re: SetMaxDynSpace blues Otto Christiaanse <ofchristiaanse@gmail.com> - 2017-04-10 06:23 -0700
  Re: SetMaxDynSpace blues "Marc Verkade" <marc@marc.marc> - 2017-04-10 21:32 +0200

csiph-web