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


Groups > comp.lang.clipper.visual-objects > #9459 > unrolled thread

SetMaxDynSize VS SetMaxThreadDynSize

Started by"Jim" <nospam@example.com>
First post2016-06-20 15:00 -0400
Last post2016-06-23 04:08 +0200
Articles 7 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  SetMaxDynSize VS SetMaxThreadDynSize "Jim" <nospam@example.com> - 2016-06-20 15:00 -0400
    Re: SetMaxDynSize VS SetMaxThreadDynSize "Jim" <nospam@example.com> - 2016-06-22 01:47 -0400
      Re: SetMaxDynSize VS SetMaxThreadDynSize "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2016-06-22 10:54 +0200
    Re: SetMaxDynSize VS SetMaxThreadDynSize Robert van der Hulst <robert@xsharp.eu> - 2016-06-22 11:04 +0200
      Re: SetMaxDynSize VS SetMaxThreadDynSize "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2016-06-22 17:35 +0200
      Re: SetMaxDynSize VS SetMaxThreadDynSize "Jim" <nospam@example.com> - 2016-06-22 12:17 -0400
      Re: SetMaxDynSize VS SetMaxThreadDynSize "Wolfgang Riedmann" <wriedmann@gmail.com> - 2016-06-23 04:08 +0200

#9459 — SetMaxDynSize VS SetMaxThreadDynSize

From"Jim" <nospam@example.com>
Date2016-06-20 15:00 -0400
SubjectSetMaxDynSize VS SetMaxThreadDynSize
Message-ID<nk9egt$fha$1@news.albasani.net>
I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is 
16MB.

The help file says about SetMaxThreadDynSize() that it is used a NEW thread, 
what about the running app?

Is this redundant and SetMaxDynSize() is what is only needed if I am not 
using threads ?

Jim 

[toc] | [next] | [standalone]


#9469

From"Jim" <nospam@example.com>
Date2016-06-22 01:47 -0400
Message-ID<nkd8q6$ohr$1@news.albasani.net>
In reply to#9459
One more thing! How can I determine the optimal value for SetMaxDynSize() on 
a computer with at least least 4 GB memory?

Jim

"Jim"  wrote in message news:nk9egt$fha$1@news.albasani.net...

I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is
16MB.

The help file says about SetMaxThreadDynSize() that it is used a NEW thread,
what about the running app?

Is this redundant and SetMaxDynSize() is what is only needed if I am not
using threads ?

Jim 

[toc] | [prev] | [next] | [standalone]


#9473

From"Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it>
Date2016-06-22 10:54 +0200
Message-ID<nkdjp1$v10$1@dont-email.me>
In reply to#9469
Hi Jim,

I think you you only have to use SetMaxDynSize. You have to set it as early 
as possible in the starting program.

There is a limit for the setting SetMaxDynSize: The overall data size of 2 
GB in Win32 programs. This limit is often reached earlier than expected, if 
there are other program parts that allocate space, for example report 
engines.
Also the "Memallocs" of certain VO functionality and the memory of the 
Windows-Windows/Windows-Controls are adding to this size. In our programs 
often we need a dynamic size of 128 MB to 256. More is often only possible 
if reports are not used and is needed only in rare cases.

Arne Ortlinghaus
ACS Data Systems


"Jim" <nospam@example.com> schrieb im Newsbeitrag 
news:nkd8q6$ohr$1@news.albasani.net...
> One more thing! How can I determine the optimal value for SetMaxDynSize() 
> on a computer with at least least 4 GB memory?
>
> Jim
>
> "Jim"  wrote in message news:nk9egt$fha$1@news.albasani.net...
>
> I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is
> 16MB.
>
> The help file says about SetMaxThreadDynSize() that it is used a NEW 
> thread,
> what about the running app?
>
> Is this redundant and SetMaxDynSize() is what is only needed if I am not
> using threads ?
>
> Jim 

[toc] | [prev] | [next] | [standalone]


#9474

FromRobert van der Hulst <robert@xsharp.eu>
Date2016-06-22 11:04 +0200
Message-ID<nkdrbu.3l4.1@xsharp.info>
In reply to#9459
Jim,

SetMaxDynSize sets the size for the main thread.
And there is really no "optimal value". What you should keep in mind is:

- VO will use static memory for a lot of things, such as the Symbol 
table, Runtime Class information etc. MemTotal() tells you how much is 
allocated at a certain moment.
- Whatever you allocate for dynamic memory will be allocated twice. VO 
works with 2 dynamic memory pages (one of these is active)


In apps that may require a lot of memory I call a method from a timer on 
the shell where I am keeping track of the used and free memory. See below.

At startup I initialize an initial amount of memory
SetMaxDynSize(0x4000000)  // Total 64 Mb per Dynamic Page = 128 Mb total
DynSize(500)      	  // = Preallocate 500 pages of 64 Kb


from the timer on the shell I call this method. You may use it at your 
own risk <g>.

METHOD CheckDynMemSize() CLASS MySHELL
     LOCAL nActualSizeAllocated AS DWORD
     LOCAL nActualSizeused    AS DWORD
     LOCAL nActualSizeMax     AS DWORD
     LOCAL nMaxDynAllowed     AS DWORD
     LOCAL nMaxPages          AS DWORD
     LOCAL nNewSizeInPages    AS DWORD
     LOCAL nNewSizeInBytes    AS DWORD
     LOCAL nUsed, nMax, nCheck  AS DWORD
     STATIC lBusy AS LOGIC
     IF ! lBusy
         lBusy := TRUE
         // Check RegisterAxit
         nUsed := Memory(MEMORY_REGISTERAXIT)
         nMax  := SetMaxRegisteredAxitMethods(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching RegisterAxit limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_REGISTERAXIT)
             IF nUsed > nCheck
                 SetMaxRegisteredAxitMethods(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF
         // Check RegisterKid
         nUsed := Memory(MEMORY_REGISTERKID)
         nMax  := SetMaxRegisteredKids(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching RegisterKid limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_REGISTERKID)
             IF nUsed > nCheck
                 SetMaxRegisteredKids(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF
         // Check KidStackSize
         nUsed := Memory(MEMORY_STACKKID)
         nMax  := SetKidStackSize(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching KidStack limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_STACKKID)
             IF nUsed > nCheck
                 SetKidStackSize(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF

         nMaxDynAllowed       := 1024*1024*128
         nMaxPages            := nMaxDynAllowed /0x10000
         nActualSizeAllocated := DynInfoSize() * 0x10000
         // DyInfoSize returns the number of 64Kb pages
         nActualSizeused      := DynInfoUsed()
         nActualSizeMax       := SetMaxDynSize(0)
         // When we have used 80 % or more of the allocated memory,
         // then it is time to allocate some more pages
         IF nActualSizeused > nActualSizeAllocated * 0.80
             CollectForced()
             nActualSizeused      := DynInfoUsed()

             IF nActualSizeused > nActualSizeAllocated * 0.80
                 nNewSizeInPages := DynInfoSize() +25 

                 nNewSizeInBytes := nNewSizeInPages * 0x10000
                 // Make sure that we do not allocate more then the 
DynInfoMax.
                 // If we reach that, then we need to set the max to a 
higher number
                 IF nNewSizeInBytes >= nActualSizeMax
                     IF nNewSizeInPages >= nMaxPages
			// Allocate some extra memory just to be sure
                         SetMaxDynSize(nMaxDynAllowed)
                     ELSE
			// Allocate some extra memory just to be sure
                         SetMaxDynSize(nNewSizeInBytes)
                         DynSize(nNewSizeInPages-1)
                     ENDIF
                 ELSE
                     DynSize(nNewSizeInPages)
                 ENDIF

             ENDIF
         ENDIF
         lBusy := FALSE
     ENDIF
RETURN NIL



Robert

> I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is
> 16MB.
>
> The help file says about SetMaxThreadDynSize() that it is used a NEW
> thread, what about the running app?
>
> Is this redundant and SetMaxDynSize() is what is only needed if I am not
> using threads ?
>
> Jim

[toc] | [prev] | [next] | [standalone]


#9475

From"Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it>
Date2016-06-22 17:35 +0200
Message-ID<nkeb7g$k5r$1@dont-email.me>
In reply to#9474
> - Whatever you allocate for dynamic memory will be allocated twice. VO
works with 2 dynamic memory pages (one of these is active)

Hi Robert,

thank you for the explanation. About a year ago I realized that when I 
inspected the programs with the vmmap.exe from sysinternals. I though 
already that this was not a nice implementation in the program memory 
management. But as we want to move to Vulcan or X# this year, I didn't 
mention it in the forums.

Arne Ortlinghaus
ACS Data Systems


"Robert van der Hulst" <robert@xsharp.eu> schrieb im Newsbeitrag 
news:nkdrbu.3l4.1@xsharp.info...
> Jim,
>
> SetMaxDynSize sets the size for the main thread.
> And there is really no "optimal value". What you should keep in mind is:
>
> - VO will use static memory for a lot of things, such as the Symbol table, 
> Runtime Class information etc. MemTotal() tells you how much is allocated 
> at a certain moment.
> - Whatever you allocate for dynamic memory will be allocated twice. VO 
> works with 2 dynamic memory pages (one of these is active)
>
>
> In apps that may require a lot of memory I call a method from a timer on 
> the shell where I am keeping track of the used and free memory. See below.
>
> At startup I initialize an initial amount of memory
> SetMaxDynSize(0x4000000)  // Total 64 Mb per Dynamic Page = 128 Mb total
> DynSize(500)        // = Preallocate 500 pages of 64 Kb
>
>
> from the timer on the shell I call this method. You may use it at your own 
> risk <g>.
>
> METHOD CheckDynMemSize() CLASS MySHELL
>     LOCAL nActualSizeAllocated AS DWORD
>     LOCAL nActualSizeused    AS DWORD
>     LOCAL nActualSizeMax     AS DWORD
>     LOCAL nMaxDynAllowed     AS DWORD
>     LOCAL nMaxPages          AS DWORD
>     LOCAL nNewSizeInPages    AS DWORD
>     LOCAL nNewSizeInBytes    AS DWORD
>     LOCAL nUsed, nMax, nCheck  AS DWORD
>     STATIC lBusy AS LOGIC
>     IF ! lBusy
>         lBusy := TRUE
>         // Check RegisterAxit
>         nUsed := Memory(MEMORY_REGISTERAXIT)
>         nMax  := SetMaxRegisteredAxitMethods(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching RegisterAxit limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_REGISTERAXIT)
>             IF nUsed > nCheck
>                 SetMaxRegisteredAxitMethods(DWORD(nMax * 1.5)) // 50% more
>             ENDIF
>         ENDIF
>         // Check RegisterKid
>         nUsed := Memory(MEMORY_REGISTERKID)
>         nMax  := SetMaxRegisteredKids(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching RegisterKid limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_REGISTERKID)
>             IF nUsed > nCheck
>                 SetMaxRegisteredKids(DWORD(nMax * 1.5)) // 50% more
>             ENDIF
>         ENDIF
>         // Check KidStackSize
>         nUsed := Memory(MEMORY_STACKKID)
>         nMax  := SetKidStackSize(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching KidStack limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_STACKKID)
>             IF nUsed > nCheck
>                 SetKidStackSize(DWORD(nMax * 1.5)) // 50% more
>             ENDIF
>         ENDIF
>
>         nMaxDynAllowed       := 1024*1024*128
>         nMaxPages            := nMaxDynAllowed /0x10000
>         nActualSizeAllocated := DynInfoSize() * 0x10000
>         // DyInfoSize returns the number of 64Kb pages
>         nActualSizeused      := DynInfoUsed()
>         nActualSizeMax       := SetMaxDynSize(0)
>         // When we have used 80 % or more of the allocated memory,
>         // then it is time to allocate some more pages
>         IF nActualSizeused > nActualSizeAllocated * 0.80
>             CollectForced()
>             nActualSizeused      := DynInfoUsed()
>
>             IF nActualSizeused > nActualSizeAllocated * 0.80
>                 nNewSizeInPages := DynInfoSize() +25
>                 nNewSizeInBytes := nNewSizeInPages * 0x10000
>                 // Make sure that we do not allocate more then the 
> DynInfoMax.
>                 // If we reach that, then we need to set the max to a 
> higher number
>                 IF nNewSizeInBytes >= nActualSizeMax
>                     IF nNewSizeInPages >= nMaxPages
> // Allocate some extra memory just to be sure
>                         SetMaxDynSize(nMaxDynAllowed)
>                     ELSE
> // Allocate some extra memory just to be sure
>                         SetMaxDynSize(nNewSizeInBytes)
>                         DynSize(nNewSizeInPages-1)
>                     ENDIF
>                 ELSE
>                     DynSize(nNewSizeInPages)
>                 ENDIF
>
>             ENDIF
>         ENDIF
>         lBusy := FALSE
>     ENDIF
> RETURN NIL
>
>
>
> Robert
>
>> I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is
>> 16MB.
>>
>> The help file says about SetMaxThreadDynSize() that it is used a NEW
>> thread, what about the running app?
>>
>> Is this redundant and SetMaxDynSize() is what is only needed if I am not
>> using threads ?
>>
>> Jim
> 

[toc] | [prev] | [next] | [standalone]


#9477

From"Jim" <nospam@example.com>
Date2016-06-22 12:17 -0400
Message-ID<nkedni$stv$1@news.albasani.net>
In reply to#9474
Hi Robert!

This is a very useful technique. I will test and see how it goes!

Jim

"Robert van der Hulst"  wrote in message news:nkdrbu.3l4.1@xsharp.info... 

Jim,

SetMaxDynSize sets the size for the main thread.
And there is really no "optimal value". What you should keep in mind is:

- VO will use static memory for a lot of things, such as the Symbol 
table, Runtime Class information etc. MemTotal() tells you how much is 
allocated at a certain moment.
- Whatever you allocate for dynamic memory will be allocated twice. VO 
works with 2 dynamic memory pages (one of these is active)


In apps that may require a lot of memory I call a method from a timer on 
the shell where I am keeping track of the used and free memory. See below.

At startup I initialize an initial amount of memory
SetMaxDynSize(0x4000000)  // Total 64 Mb per Dynamic Page = 128 Mb total
DynSize(500)        // = Preallocate 500 pages of 64 Kb


from the timer on the shell I call this method. You may use it at your 
own risk <g>.

METHOD CheckDynMemSize() CLASS MySHELL
     LOCAL nActualSizeAllocated AS DWORD
     LOCAL nActualSizeused    AS DWORD
     LOCAL nActualSizeMax     AS DWORD
     LOCAL nMaxDynAllowed     AS DWORD
     LOCAL nMaxPages          AS DWORD
     LOCAL nNewSizeInPages    AS DWORD
     LOCAL nNewSizeInBytes    AS DWORD
     LOCAL nUsed, nMax, nCheck  AS DWORD
     STATIC lBusy AS LOGIC
     IF ! lBusy
         lBusy := TRUE
         // Check RegisterAxit
         nUsed := Memory(MEMORY_REGISTERAXIT)
         nMax  := SetMaxRegisteredAxitMethods(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching RegisterAxit limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_REGISTERAXIT)
             IF nUsed > nCheck
                 SetMaxRegisteredAxitMethods(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF
         // Check RegisterKid
         nUsed := Memory(MEMORY_REGISTERKID)
         nMax  := SetMaxRegisteredKids(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching RegisterKid limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_REGISTERKID)
             IF nUsed > nCheck
                 SetMaxRegisteredKids(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF
         // Check KidStackSize
         nUsed := Memory(MEMORY_STACKKID)
         nMax  := SetKidStackSize(0)
         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
         IF nUsed > nCheck // > 90%
             DebOut("Approaching KidStack limit, COLLECTFORCED")
             Sleep(2000)
             CollectForced()
             nUsed := Memory(MEMORY_STACKKID)
             IF nUsed > nCheck
                 SetKidStackSize(DWORD(nMax * 1.5)) // 50% more
             ENDIF
         ENDIF

         nMaxDynAllowed       := 1024*1024*128
         nMaxPages            := nMaxDynAllowed /0x10000
         nActualSizeAllocated := DynInfoSize() * 0x10000
         // DyInfoSize returns the number of 64Kb pages
         nActualSizeused      := DynInfoUsed()
         nActualSizeMax       := SetMaxDynSize(0)
         // When we have used 80 % or more of the allocated memory,
         // then it is time to allocate some more pages
         IF nActualSizeused > nActualSizeAllocated * 0.80
             CollectForced()
             nActualSizeused      := DynInfoUsed()

             IF nActualSizeused > nActualSizeAllocated * 0.80
                 nNewSizeInPages := DynInfoSize() +25 

                 nNewSizeInBytes := nNewSizeInPages * 0x10000
                 // Make sure that we do not allocate more then the 
DynInfoMax.
                 // If we reach that, then we need to set the max to a 
higher number
                 IF nNewSizeInBytes >= nActualSizeMax
                     IF nNewSizeInPages >= nMaxPages
// Allocate some extra memory just to be sure
                         SetMaxDynSize(nMaxDynAllowed)
                     ELSE
// Allocate some extra memory just to be sure
                         SetMaxDynSize(nNewSizeInBytes)
                         DynSize(nNewSizeInPages-1)
                     ENDIF
                 ELSE
                     DynSize(nNewSizeInPages)
                 ENDIF

             ENDIF
         ENDIF
         lBusy := FALSE
     ENDIF
RETURN NIL



Robert

> I know the default for the SetMaxDynSize() and SetMaxThreadDynSize() is
> 16MB.
>
> The help file says about SetMaxThreadDynSize() that it is used a NEW
> thread, what about the running app?
>
> Is this redundant and SetMaxDynSize() is what is only needed if I am not
> using threads ?
>
> Jim

[toc] | [prev] | [next] | [standalone]


#9482

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2016-06-23 04:08 +0200
Message-ID<dt0ukmF4gefU1@mid.individual.net>
In reply to#9474
Hi Robert,

this is a very interesting piece of code! Thank you very much!

But hopefully I'll be able to move my largest programs over to .NET in
the next 12 months, so I don't need this anymore (again: I hope!)

Wolfgang

Robert van der Hulst wrote:

> Jim,
> 
> SetMaxDynSize sets the size for the main thread.
> And there is really no "optimal value". What you should keep in mind
> is:
> 
> - VO will use static memory for a lot of things, such as the Symbol
> table, Runtime Class information etc. MemTotal() tells you how much
> is allocated at a certain moment.  - Whatever you allocate for
> dynamic memory will be allocated twice. VO works with 2 dynamic
> memory pages (one of these is active)
> 
> 
> In apps that may require a lot of memory I call a method from a timer
> on the shell where I am keeping track of the used and free memory.
> See below.
> 
> At startup I initialize an initial amount of memory
> SetMaxDynSize(0x4000000)  // Total 64 Mb per Dynamic Page = 128 Mb
> total DynSize(500)      	  // = Preallocate 500 pages of 64 Kb
> 
> 
> from the timer on the shell I call this method. You may use it at
> your own risk <g>.
> 
> METHOD CheckDynMemSize() CLASS MySHELL
>     LOCAL nActualSizeAllocated AS DWORD
>     LOCAL nActualSizeused    AS DWORD
>     LOCAL nActualSizeMax     AS DWORD
>     LOCAL nMaxDynAllowed     AS DWORD
>     LOCAL nMaxPages          AS DWORD
>     LOCAL nNewSizeInPages    AS DWORD
>     LOCAL nNewSizeInBytes    AS DWORD
>     LOCAL nUsed, nMax, nCheck  AS DWORD
>     STATIC lBusy AS LOGIC
>     IF ! lBusy
>         lBusy := TRUE
>         // Check RegisterAxit
>         nUsed := Memory(MEMORY_REGISTERAXIT)
>         nMax  := SetMaxRegisteredAxitMethods(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching RegisterAxit limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_REGISTERAXIT)
>             IF nUsed > nCheck
>                 SetMaxRegisteredAxitMethods(DWORD(nMax * 1.5)) // 50%
> more             ENDIF
>         ENDIF
>         // Check RegisterKid
>         nUsed := Memory(MEMORY_REGISTERKID)
>         nMax  := SetMaxRegisteredKids(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching RegisterKid limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_REGISTERKID)
>             IF nUsed > nCheck
>                 SetMaxRegisteredKids(DWORD(nMax * 1.5)) // 50% more
>             ENDIF
>         ENDIF
>         // Check KidStackSize
>         nUsed := Memory(MEMORY_STACKKID)
>         nMax  := SetKidStackSize(0)
>         nCheck := DWORD(MulDiv(LONG(nMax), 90, 100))
>         IF nUsed > nCheck // > 90%
>             DebOut("Approaching KidStack limit, COLLECTFORCED")
>             Sleep(2000)
>             CollectForced()
>             nUsed := Memory(MEMORY_STACKKID)
>             IF nUsed > nCheck
>                 SetKidStackSize(DWORD(nMax * 1.5)) // 50% more
>             ENDIF
>         ENDIF
> 
>         nMaxDynAllowed       := 1024*1024*128
>         nMaxPages            := nMaxDynAllowed /0x10000
>         nActualSizeAllocated := DynInfoSize() * 0x10000
>         // DyInfoSize returns the number of 64Kb pages
>         nActualSizeused      := DynInfoUsed()
>         nActualSizeMax       := SetMaxDynSize(0)
>         // When we have used 80 % or more of the allocated memory,
>         // then it is time to allocate some more pages
>         IF nActualSizeused > nActualSizeAllocated * 0.80
>             CollectForced()
>             nActualSizeused      := DynInfoUsed()
> 
>             IF nActualSizeused > nActualSizeAllocated * 0.80
>                nNewSizeInPages := DynInfoSize() +25
>                 nNewSizeInBytes := nNewSizeInPages * 0x10000
>                // Make sure that we do not allocate more then the
> DynInfoMax.                 // If we reach that, then we need to set
> the max to a higher number                 IF nNewSizeInBytes >=
> nActualSizeMax                     IF nNewSizeInPages >= nMaxPages
> 			// Allocate some extra memory just to be sure
>                         SetMaxDynSize(nMaxDynAllowed)
>                     ELSE
> 			// Allocate some extra memory just to be sure
>                         SetMaxDynSize(nNewSizeInBytes)
>                         DynSize(nNewSizeInPages-1)
>                     ENDIF
>                 ELSE
>                     DynSize(nNewSizeInPages)
>                 ENDIF
> 
>             ENDIF
>         ENDIF
>         lBusy := FALSE
>     ENDIF
> RETURN NIL
> 
> 
> 
> Robert
> 
> > I know the default for the SetMaxDynSize() and
> > SetMaxThreadDynSize() is 16MB.
> > 
> > The help file says about SetMaxThreadDynSize() that it is used a NEW
> > thread, what about the running app?
> > 
> > Is this redundant and SetMaxDynSize() is what is only needed if I
> > am not using threads ?
> > 
> > Jim



-- 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web