I’ve got a singleton with a variable: ```object My...
# multiplatform
b
I’ve got a singleton with a variable:
Copy code
object MyObject {
    private var myVar: SomeObject? = null
}
and during a build I get:
i: file: <path to the file> With old Native GC, variable in singleton without @ThreadLocal can’t be changed after initialization
I’m using 1.8.0, and I thought the new memory manager is used by default since 1.7.20 … ???
👆 1
j
You can still opt-out, and that can happen downstream outside your control.
b
@jw thanks for the info. I haven’t opted out myself, but perhaps it is something downstream. I’m seeing this in my database module, which is leveraging sqldelight 1.5 … Perhaps that is using the old memory management? Looks like support for the new memory model was added in 2.0.0-alpha03
j
I'm saying that during compilation of your module you cannot know what memory model will be in use at runtime
h
Does this mean that when you're writing a KMM library that depends on the new memory model, it is wise to put a runtime check that makes sure the correct memory model is used so you can give a better error message in case a consumer of your library by accident uses the legacy memory model?
b
Ooooooh, I see what you’re saying now, duh. And that’s why the build message is “info” and not warning or error.