News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Masm lib problem

Started by Farabi, August 25, 2008, 01:30:41 AM

Previous topic - Next topic

Farabi

Take a look at Window Task Manager when you use circle or line function, the memory usage is keep increasing as you call the function(about 20 k each call). Is it normal?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

hutch--

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ChrisLeslie

I remember running into this problem with "line.asm" in m32lib. I believe I invoked an extra delete object for "HPenOld" and re-assembled the module. Then it stopped chewing up memory after many calls to the line primitive. - Chris

hutch--

Thanks Chris,

The "line" algo was missing a ReleaseDC() call at the exit of the proc. Got the hickups REAL BAD after a few hundred million calls.  :bg File was dated 1999 and no-one ever noticed it before. This is the fixed and modernised algo and the test piece is attached.


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

linex proc hndl:DWORD,colr:DWORD,x1:DWORD,y1:DWORD,x2:DWORD,y2:DWORD

    LOCAL hDC     :DWORD
    LOCAL hPen    :DWORD
    LOCAL hPenOld :DWORD

    mov hDC, rv(GetDC,hndl)
    mov hPen, rv(CreatePen,0,1,colr)
    mov hPenOld, rv(SelectObject,hDC,hPen)

    invoke MoveToEx,hDC,x1,y1,NULL
    invoke LineTo,hDC,x2,y2

    invoke SelectObject,hDC,hPenOld
    invoke DeleteObject,hPen
    invoke ReleaseDC,hndl,hDC

    ret

linex endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Quote from: hutch-- on August 25, 2008, 06:42:30 AM
Thanks Chris,

The "line" algo was missing a ReleaseDC() call at the exit of the proc. Got the hickups REAL BAD after a few hundred million calls.  :bg

New type??

hickups  REAL BAD 500000000