Chanjung Kim
02/16/2024, 11:40 PMChanjung Kim
02/16/2024, 11:41 PMspierce7
02/17/2024, 2:06 AMspierce7
02/17/2024, 2:06 AMChanjung Kim
02/17/2024, 3:23 AMEdoardo Luppi
02/17/2024, 5:11 PMspierce7
02/18/2024, 12:52 AMmarkguo6
02/18/2024, 6:38 AMint status = 0;
waitpid(pid, &status, WCONTINUED | WTRUNCATED);
Kotlin has access to waitpid via the platform.posix library. However, in Kotlin, neither
var status:Int = 0;
waitpid(pid, status, WCONTINUED or WTRUNCATED);
nor
var status:Int = 0;
waitpid(pid, status.ptr, WCONTINUED or WTRUNCATED);
works.brabo-hi
02/18/2024, 9:23 AMChanjung Kim
02/18/2024, 5:04 PMDan Kaser
02/22/2024, 6:00 AMDevanshu Vaidya
02/22/2024, 7:27 PMmap[key] = map.getOrPut(key){ defaultValue} + someOperation
2. map[key] = map[key]?.let{ it -> someOperation} ?: defaultValue
3. if(!map.contains(key)) { map.put(key, value) }
cb
02/23/2024, 3:08 PMlinkDebugTestIosSimulatorArm64
on every module with a test just takes forever. We're very close to stopping running iOS tests on our CI runs and running it nightly.Andrey
02/24/2024, 8:26 AMvoid* getprt(){
return (void *)(&open);
}
I can implement this via a.h and a.def , but would like to get rid of this
staticCFunction(::open)
Because I'll get a link to myself.Any ideas , thanks.Krystian
02/26/2024, 6:54 PMplatform.posix
library on Linux and I found an issue:
error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
The linux distro has upgraded the libcrypto to libcrypt.so.2 and it exists. Is there a work around this by any chance?Matt Nelson
02/27/2024, 1:36 PMposix_spawn_file_actions_addchdir_fp
, but because kotlin compiles against glibc < 2.29
, it is not available from Kotlin.
I would like to call it if the gnu_get_libc_version
returns 2.29
or greater, instead of having to fall back to doing fork/exec.
As far as I am aware, syscall
cannot be used to call this function, so.
Any thoughts?Sven Wiegand
02/27/2024, 2:07 PM@Serializable
public data class DictionaryEntry(
@SerialName("Label")
val label: String,
)
public class MyWorker(val data: Array<DictionaryEntry>) {
val mappedData = data.map{it.label}
}
I also had a function to create the Array of DictionaryEntrys:
public fun createDictionaryEntry(label: String): COpaquePointer {
val entry = DictionaryEntry(label)
val ref = StableRef.create(entry)
return ref.asCPointer()
}
fun makeList(ptr: CArrayPointer<COpaquePointerVar>, size:Int): COpaquePointer {
val intermediate = ArrayList<DictionaryEntry>(size)
for (index in 0 until size){
val ref = ptr[index]!!.asStableRef<DictionaryEntry>()
intermediate.add(ref.get())
ref.dispose()
}
println("size of list is: ${intermediate.size}")
val ref = StableRef.create(intermediate)
return ref.asCPointer()
}
So far so good.
I can create the array with the entries and release it again with the DisposeStablePointer function without having memory leaks.
However, if I create an object of the MyWorker class, the whole thing leaks.
I have tried the following approaches here:
C++ Code:
void* worker1 = MyKotlinLib::instance()->kotlin.root.createMyWorker(dictionaryEntries.pinned);
MyKotlinLib::instance()->DisposeStablePointer(worker)
Kotlin Code:
public fun createMyWorker(ptr: COpaquePointer) : COpaquePointer{
val dict = ptr.asStableRef<ArrayList<DictionaryEntry>>()
val worker = MyWorker(dict.get().toList())
val ref = StableRef.create(worker)
dict.dispose()
return ref.asCPointer()
}
and this approach:
C++ Code:
void* worker = MyKotlinLib::instance()-><http://kotlin.root.de|kotlin.root.de>.MyWorker.MyWorker(dictionaryEntries.pinned)
Any ideas how to avoid the memory leaks here?Joel Denke
02/28/2024, 7:11 AMjQrgen
02/28/2024, 10:00 AM> Task :mpthreads:iosSimulatorArm64Test FAILED
Invalid connection: com.apple.coresymbolicationd
kotlin.AssertionError: Expected <7077888>, actual <5242880>.
kotlin.AssertionError: Expected <7077888>, actual <5242880>.
at kotlin.Error#<init>(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:14)
at kotlin.AssertionError#<init>(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:132)
at kotlin.test.DefaultAsserter#fail(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/DefaultAsserter.kt:16)
at kotlin.test.Asserter#fail(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:634)
at kotlin.test.Asserter#assertTrue(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:652)
at kotlin.test.Asserter#assertTrue(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:650)
at kotlin.test.Asserter#assertEquals(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:671)
at kotlin.test.Asserter#assertEquals(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:670)
at kotlin.test#assertEquals(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:63)
at kotlin.test#assertEquals$default(/opt/buildAgent/work/2fed3917837e7e79/kotlin/libraries/kotlin.test/common/src/main/kotlin/kotlin/test/Assertions.kt:62)
at <global>.#test(/Users/bu/dev/mpthreads/mpthreads/src/nativeTest/kotlin/test.kt:26)
at $test$FUNCTION_REFERENCE$0.invoke#internal(/Users/bu/dev/mpthreads/mpthreads/src/nativeTest/kotlin/test.kt:21)
at $test$FUNCTION_REFERENCE$0.$<bridge-UNN>invoke(/Users/bu/dev/mpthreads/mpthreads/src/nativeTest/kotlin/test.kt:21)
at kotlin.Function0#invoke(/Users/teamcity/.gradle/daemon/8.2.1/[K][Suspend]Functions:1)
at kotlin.native.internal.test.TopLevelSuite.TestCase#run(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestSuite.kt:153)
at kotlin.native.internal.test.TestCase#run(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestSuite.kt:19)
at kotlin.native.internal.test.TestRunner.run#internal(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:248)
at kotlin.native.internal.test.TestRunner.runIteration#internal(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:274)
at kotlin.native.internal.test.TestRunner#run(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/TestRunner.kt:289)
at kotlin.native.internal.test#testLauncherEntryPoint(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt:33)
at kotlin.native.internal.test#main(/opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/test/Launcher.kt:38)
at <global>.Konan_start(/Users/bu/.gradle/daemon/8.6/entryPointOwner:1)
at <global>.Init_and_run_start(Unknown Source)
at <global>.0x0(Unknown Source)
at <global>.0x0(Unknown Source)
at <global>.0x0(Unknown Source)
TestKt.test[iosSimulatorArm64] FAILED
kotlin.AssertionError at /opt/buildAgent/work/2fed3917837e7e79/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:14
1 test completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mpthreads:iosSimulatorArm64Test'.
> There were failing tests. See the report at: file:///Users/bu/dev/mpthreads/mpthreads/build/reports/tests/iosSimulatorArm64Test/index.html
* Try:
> Run with --scan to get full insights.
BUILD FAILED in 4s
7 actionable tasks: 4 executed, 3 up-to-date
11:08:12: Execution finished ':mpthreads:cleanIosSimulatorArm64Test :mpthreads:iosSimulatorArm64Test --tests "TestKt.test"'.
It is indeed frustrating when the example test doesn't pass. I can also see that "'GC' is deprecated. Use kotlin.native.runtime.GC instead." are the docs outdated?
How can we check for memory leaks when kotlin.native.internal.GC.lastGCInfo()
is not working?jQrgen
02/28/2024, 10:43 AM-Xruntime-logs=gc=info
... found where to set the flagVaibhav Jaiswal
02/28/2024, 1:58 PM:shared:core
and :shared:ui
, which is only being used internally, as I am using Compose Multiplatform and not using any of those pod dependencies on the Native Swift Side
:shared
being the umbrella module ,do i need to add :shared:core
, :shared:ui
in the iosApp/Podfile
like this pod 'shared-core', :path => '../shared/core'
?kevin.cianfarini
03/05/2024, 2:31 PMAnyObject
, what would that be in Kotlin? Any
in Kotlin is just Any
in swift. Would it be Any?
Giorgi
03/06/2024, 10:22 AMchandilsachin
03/08/2024, 9:10 PMUndefined symbols:
Linker command failed with exit code 1 (use -v to see invocation)
How do I make it work?spierce7
03/11/2024, 12:53 AMDmitry Motyl
03/13/2024, 1:19 PMnatario1
03/14/2024, 7:00 PMEXC_BAD_ACCESS
when my Swift struct manipulates a Kotlin Native class. I’m doing almost nothing with it, just create it and try to print to console. But the crash can be reproduced consistently.
Does anyone know if similar issues were solved between Kotlin 1.9.10 and latest version? I’d like to avoid updating at this moment since it comes with other tasks.stoyicker
03/15/2024, 12:16 PMaxeon
03/17/2024, 7:52 AMgradle publish
, only a .jar
file gets published. Afaik, it's necessary to include a .klib
as well for it to be used in other Native projects, and the problem is that publishing does not generate/upload that .klib
file.
Build file:
https://github.com/reblast/KPresence/blob/master/build.gradle.ktsTobias
03/18/2024, 6:22 PMktgio
- but maybe I have some bit shiffting issues.