Status Update
Comments
ow...@google.com <ow...@google.com>
ro...@google.com <ro...@google.com>
yb...@google.com <yb...@google.com> #2
yb...@google.com <yb...@google.com> #3
Hi, Thanks for reporting the issue.
Please share screen recording for better understanding.
Please capture the bugreport immediately after the issue and share it.
Please provide a brief description of the issue for better understanding.
Follow the below procedure to capture.
Step 1: Enable Developer Options, USB debugging and Bug Report Shortcut
1.Go to Settings → About Phone a.Tap on “Build Number” seven times (7).
2.Go to Settings → System → Advanced → Developer Options. (Note: In some phones this is embedded in another path. Please search for “USB debugging” in your settings search box if you are unable to find this setting)
a.Enable “USB Debugging”
b.Enable “Bug report shortcut” (allows you to quickly capture bug report by long-pressing power button and selecting “Take bug report”)
Note: Please upload the bug report to google drive and share the folder to
yb...@google.com <yb...@google.com> #4
Please provide the input requested, or the issue would be closed in a week.
yb...@google.com <yb...@google.com> #5
We're closing this issue due to not having enough actionable information. If you continue to have this issue, please file a new issue and add the relevant information along with a reference link to the earlier issue.
Description
Version used: 1.0.0
Theme used: N/A
Devices/Android versions reproduced on: Unit tests
The effect I am trying to achieve is to:
1. Create a `DataStore` for a particular file, that is shared when needed but is garbage-collectable when no longer needed
2. Create a new `DataStore` for that file when it has been garbage collected and is once again needed
This is currently difficult because:
1. Keeping a reference to a `DataStore`'s `scope` prevents it from being garbage collected
2. The only way to remove a value from `activeFiles` is to cancel the `DataStore`'s `scope`
One potential fix for this is to avoid capturing a strong reference to the `DataStore` or its `downstreamFlow` in the `consumeMessage` callback passed to `SimpleActor`. This would allow keeping a reference to the scope for cancellation while still allowing the DataStore and its value to be garbage-collectable.
The following code illustrates what I would like to do, but it loops forever at MARK A:
@Test fun test() {
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
var store: DataStore<Unit>? = DataStoreFactory.create(
object : Serializer<Unit> {
override val defaultValue = Unit
override suspend fun readFrom(input: InputStream) = Unit
override suspend fun writeTo(t: Unit, output: OutputStream) {
}
},
produceFile = { File("/tmp/foo") },
scope = scope!!,
)
val storeReference = WeakReference(store)
store = null
while (storeReference.get() != null) { // MARK A
System.gc()
}
scope.cancel()
}