[Question] Memory management #67

Closed
opened 2025-08-12 16:38:35 +02:00 by Sylphrena · 2 comments
Contributor

Hi! Thank you for this library!

This isn't really an issue, but a question out of curiosity, since I just recently picked up Swift and the source code is not entirely clear to me yet.

How is memory handled in adwaita-swift? Generally, in other languages, signals and property bindings prevent an object from being freed, leading to memory leaks unless disconnected properly.

Is there some closure data manager or ref toggling?

Thanks in advance!

Hi! Thank you for this library! This isn't really an issue, but a question out of curiosity, since I just recently picked up Swift and the source code is not entirely clear to me yet. How is memory handled in `adwaita-swift`? Generally, in other languages, signals and property bindings prevent an object from being freed, leading to memory leaks unless disconnected properly. Is there some closure data manager or ref toggling? Thanks in advance!

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting/

TL;DR Swift figures out when to free memory and how long something should live. Additionally, when a view is destroyed its state is destroyed (and freed) too. You don’t have to worry about memory management all that much, and Swift 6 literally won’t let you create a memory leak. If you see a leak in your app, it is coming from Libadwaita, which is written in C.

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting/ TL;DR Swift figures out when to free memory and how long something should live. Additionally, when a view is destroyed its state is destroyed (and freed) too. You don’t have to worry about memory management all that much, and Swift 6 literally won’t let you create a memory leak. If you see a leak in your app, it is coming from Libadwaita, which is written in C.
Author
Contributor

Thank you!

Thank you!
Sign in to join this conversation.
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aparoksha/adwaita-swift#67
No description provided.