Closed kb2ma closed 4 years ago
Sorry, I'm not a heavy valgrind user, can't make a good use of its output. It seems however that the leaks are coming from SDL, X, and fontconfig (which is loaded lazily when fonts are rendered. In your case SegmentedControl triggered it). I would assume those are one-shot globals and nothing to worry about. Unless you can prove that the leaks are growing over runtime.
OK, thanks. I am not a Valgrind expert either. I am just digging in to a project with nimx, and will monitor memory use over time.
In my project, I use a SegmentedControl to switch the current view. I'd like to confirm that the approach in main.nim shown below is the idiomatic way to do it, and that I can expect GC to clean up any resources for the replaced view.
let nv = View(newObjectOfClass(allSamples[firstSelectedRow].className))
nv.init(currentView.frame)
nv.resizingMask = "wh"
splitView.replaceSubview(currentView, nv)
currentView = nv
I'd like to confirm that the approach...
Regarding the GC there's nothing to worry about. However I would suggest using the new layout syntax rather than procedural view creation. Samples: https://github.com/yglukhov/nimx/blob/master/test/sample14_layout.nim https://github.com/yglukhov/nimx/blob/version-2/test/main.nim
Docs: https://github.com/yglukhov/nimx/blob/version-2/doc/layout-dsl.md
Thanks for the links. I'm just starting to think about layouts.
I'll close for now and monitor memory use.
I have found significant memory issues when running Valgrind on a minimal nimx application. Details below, and I'd appreciate any insights. Am I missing something?
Environment
Application
nimx_mem.nim
Build and Run
After the app starts, I just close it without interacting with it.
Results, without SegmentedControl
Results, with SegmentedControl
Removed the comments from the code. This run shows significantly more problems with only the addition of the segmented control.