Announcement

Collapse
No announcement yet.

GlobalAlloc...

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

  • #21
    Semen, I've not debugged it, but your code does a GPF for me (under Windows 2000).



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #22
      Lance --
      it's enough strange.
      I can imagine only that you have less physical/virtual memory than I.
      Try to reduce nn and/or For i1 = 1 To 7 (to 6 5 4)



      ------------------
      E-MAIL: [email protected]

      Comment


      • #23
        Hi Semen

        I tested the Heap* functions and CoTaskMem* functions on my
        PII 400 MHz 256MB Ram and got interesting results. CoTaskMem*
        is faster than the Heap* functions using allocation of 1024 bytes
        for allocations larger than 1024 bytes.

        Interestingly the results are identical using allocations of
        512 bytes until 8Kb - 32Kb is allocated where CoTaskMemAlloc
        is faster. It leads me to think that CoTaskMemAlloc does use
        the HeapFunctions for smaller allocations. However CoTaskMemAlloc
        probably uses pooled virtual memory for larger allocations
        (see the results for 16Kb and 32Kb with 512 byte allocation).

        CoTaskMemAlloc seems to be very efficient. I'll post some tests
        using CoGetMalloc as soon as I get the time.

        Here are the results but they are to be taken with a pinch of salt
        since a series of timing runs shows large fluctuations across
        calls - it depends on the state of the system.

        Addendum: I forgot to mention that the Heap* functions were tested with
        %HEAP_ZERO_MEMORY OR %HEAP_NO_SERIALIZE so the comparison only is
        only valid for that combination.

        1024 byte allocation granularity results
        ---------------------------------------------------------------------
        Heap:
        Size = 1 Kb: 39.062500 ms per 1000 HeapAlloc/Free; total 1280 ms
        Size = 2 Kb: 74.218750 ms per 1000 HeapAlloc/Free; total 1216 ms
        Size = 4 Kb: 46.875000 ms per 1000 HeapAlloc/Free; total 384 ms
        Size = 8 Kb: 46.875000 ms per 1000 HeapAlloc/Free; total 192 ms
        Size = 16 Kb: 562.500000 ms per 1000 HeapAlloc/Free; total 1152 ms
        Size = 32 Kb: 437.500000 ms per 1000 HeapAlloc/Free; total 448 ms
        Size = 64 Kb: 625.000000 ms per 1000 HeapAlloc/Free; total 320 ms

        CoTaskMemAlloc:
        Size = 1 Kb: 66.406250 ms per 1000 CoTaskMemAlloc/Free; total 2176 ms
        Size = 2 Kb: 74.218750 ms per 1000 CoTaskMemAlloc/Free; total 1216 ms
        Size = 4 Kb: 31.250000 ms per 1000 CoTaskMemAlloc/Free; total 256 ms
        Size = 8 Kb: 31.250000 ms per 1000 CoTaskMemAlloc/Free; total 128 ms
        Size = 16 Kb: 468.750000 ms per 1000 CoTaskMemAlloc/Free; total 960 ms
        Size = 32 Kb: 187.500000 ms per 1000 CoTaskMemAlloc/Free; total 192 ms
        Size = 64 Kb: 125.000000 ms per 1000 CoTaskMemAlloc/Free; total 64 ms

        512 byte allocation granularity results
        -------------------------------------------------------------------
        Heap:
        Size = 512 b: 15.625000 ms per 1000 HeapAlloc/Free; total 256 ms
        Size = 1 Kb: 15.625000 ms per 1000 HeapAlloc/Free; total 128 ms
        Size = 2 Kb: 31.250000 ms per 1000 HeapAlloc/Free; total 128 ms
        Size = 4 Kb: 0.000000 ms per 1000 HeapAlloc/Free; total 0 ms
        Size = 8 Kb: 250.000000 ms per 1000 HeapAlloc/Free; total 256 ms
        Size = 16 Kb: 250.000000 ms per 1000 HeapAlloc/Free; total 128 ms
        Size = 32 Kb: 250.000000 ms per 1000 HeapAlloc/Free; total 64 ms


        CoTaskMemAlloc
        Size = 512 b: 15.625000 ms per 1000 CoTaskMemAlloc/Free; total 256 ms
        Size = 1 Kb: 15.625000 ms per 1000 CoTaskMemAlloc/Free; total 128 ms
        Size = 2 Kb: 15.625000 ms per 1000 CoTaskMemAlloc/Free; total 64 ms
        Size = 4 Kb: 31.250000 ms per 1000 CoTaskMemAlloc/Free; total 64 ms
        Size = 8 Kb: 0.000000 ms per 1000 CoTaskMemAlloc/Free; total 0 ms
        Size = 16 Kb: 125.000000 ms per 1000 CoTaskMemAlloc/Free; total 64 ms
        Size = 32 Kb: 0.000000 ms per 1000 CoTaskMemAlloc/Free; total 0 ms



        [This message has been edited by Florent Heyworth (edited October 04, 2000).]

        Comment

        Working...
        X