So I am tracking down some memory leaks in a rather complex program as I appear to be losing 5/6mb's from the baseline when first loaded and I have tracked it back to a call to OpenFileRequester().
When I first load my program it idles at around 6.5mb's (Task manager) and when I load in a stress test project file it goes up to 30+mb's and I clear the project, free structures, arrays etc I get back down to around 12mb's, for 2 days I been pulling my hair out trying to find where I am loseing 6mb's so I did a step by step and noticed that just calling OpenFileRequester() without even loading any file causes the memory usage to jump 6mb, when I close the requester the memory usage does not fall it stays at a little over 12mb.
Is this usual and expected or an internal PB memory leak?
You do not need a complex project to recreate this, simply open task manager and use the example from the docs, select Open* or Save* and see the memory jump and not fall
Code: Select all
If OpenWindow(0, 100, 200, 300, 200, "PureBasic - Requesters example")
If CreateMenu(0, WindowID(0))
MenuTitle("Test")
MenuItem(0, "Open")
MenuItem(1, "Save")
MenuItem(6, "Path")
MenuBar()
MenuItem(2, "Choose a color")
MenuItem(3, "Choose a font")
MenuBar()
MenuItem(4, "Simple message")
MenuBar()
MenuItem(5, "Quit")
EndIf
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Menu ; A Menu item has been selected
Select EventMenu()
Case 0 ; OpenFileRequester
File$ = OpenFileRequester("PureBasic - Open", "Pure.txt", "Text (*.txt)|*.txt;*.bat|(PureBasic (*.pb)|*.pb", 0)
If File$+File$
MessageRequester("Information", "Selected File: "+File$, 0);
EndIf
Case 1 ; SaveFileRequester
File$ = SaveFileRequester("PureBasic - Save", "Basic.pb", "Text (*.txt)|*.txt|(PureBasic (*.pb)|*.pb", 1)
If File$
MessageRequester("Information", "Selected File: "+File$, 0);
EndIf
Case 2 ; ColorRequester
Colour = ColorRequester()
If Colour > -1
MessageRequester("Info", "Colour choosen: Red: "+Str(Red(Colour))+", Green: "+Str(Green(Colour))+", Blue: "+Str(Blue(Colour)), 0);
EndIf
Case 3 ; FontRequester
If FontRequester("Courier", -13, 0)
MessageRequester("Info", "Selected font: "+SelectedFontName()+Chr(10)+"Font size: "+Str(SelectedFontSize()), 0)
EndIf
Case 4 ; MessageRequester
MessageRequester("Information", "Simple Message"+Chr(13)+"Line 2"+Chr(13)+"Line 3", 0)
Case 5 ; Quit
Quit = 1
Case 6
Path$ = PathRequester("Choose a path...","C:\")
If Path$
MessageRequester("Information", "Selected Path: "+Path$, 0)
EndIf
EndSelect
Case #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = 1
EndSelect
Until Quit = 1
EndIf
End 
