DrawImageRect: Memory leak
Archives Forums/BlitzMax Bug Reports/DrawImageRect: Memory leak
| ||
Hello, a friend gave me a part of his code and told me that the code have a memory leak. But then I saw that the function "DrawImageRect" have a memory leak. This Code is with fix: Graphics 640,480 Local Image:TImage=CreateImage(255,255) Local Map:TPixmap,x:Int,y:Int,d:Byte SetBlend ALPHABLEND While Not AppTerminate() Map= LockImage(Image) For x= 0 To 254 For y = 0 To 254 WritePixel(Map,x,y,-278619) Next Next UnlockImage(Image) DrawImageRect(Image,0,0,640,480) DrawText "GCMemAlloced = "+(Float(GCMemAlloced())/1024)+" kb",0,0 DrawText "Press 'A' to enable GCCollect() (fix)",0,20 If d Then GCCollect() '<- FIX! DrawText "Enable",0,40 Else DrawText "Disabled",0,40 EndIf If KeyHit(KEY_A) Then If d=False Then d=True Else d=False EndIf EndIf Flip Wend My System: Windows 7 Ultimate 32-Bit 3GB Ram I hope that I could help. THX Klin Last edited 2011 |
| ||
Just tested using v1.42, no memory leak here - the GCMem never goes past 80KB and the application never goes past 40MB (viewed from Task manager). What version of BlitzMax are you running? And how bad was the memory leak? |
| ||
Same here. With or without the fix, no difference at all. No leak. (Tested on XP btw) Last edited 2011 |
| ||
MaxIDE: 1.40 BCC Version: 1.42 MinGW: C:\MinGW FASM Version: 1.69.14 GCC Version: 4.5.0 G++ Version: 4.5.0 I tested this code today again on 3 PCs (with XP and Windows 7) and the memory still leak. :/ And the memory leak goes until 1.000.000 K. Then I closed the game. Klin EDIT: An other PC with XP here don't have the memory leak Oo. Last edited 2011 |