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?
Which LIB function ?
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
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]
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