[Solved] ScreenOutput big memory leak
Posted: Thu Oct 11, 2012 6:38 pm
Hopefully my last bug report
I was looking for causes of slowdown, and I noticed my game's memory usage was reaching 800+ MB! I narrowed it down to the Start/StopDrawing block and specifically the ScreenOutput command...
Previously, I added a ScreenOutput() check before calling StartDrawing() to prevent occasional null pointer errors I was having at that code line. But removing that check seems to fix the memory leak.
On OSX 10.7:
without checking ScreenOutput(), ~60 MB usage
checking ScreenOutput(), 800+ MB
I was looking for causes of slowdown, and I noticed my game's memory usage was reaching 800+ MB! I narrowed it down to the Start/StopDrawing block and specifically the ScreenOutput command...
Previously, I added a ScreenOutput() check before calling StartDrawing() to prevent occasional null pointer errors I was having at that code line. But removing that check seems to fix the memory leak.
On OSX 10.7:
without checking ScreenOutput(), ~60 MB usage
checking ScreenOutput(), 800+ MB
Code: Select all
InitSprite()
OpenWindow(0, 0, 0, 480, 360, "ScreenOutput memory", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 480, 360, 0, 0, 0)
Repeat
ClearScreen(0) ; this doesn't make a difference
; Use this line: memory usage shoots up to 800 MB!
If (ScreenOutput() And StartDrawing(ScreenOutput()))
; Use this line: memory usage sits around 60 MB
;If (StartDrawing(ScreenOutput()))
StopDrawing()
EndIf
FlipBuffers() ; this doesn't make a difference
Until WaitWindowEvent(10) = #PB_Event_CloseWindow