Looked at the resource usage for a program I had d...
# kotlin-native
n
Looked at the resource usage for a program I had developed. After running the program for over 90 min I found that CPU usage is very low, but the memory usage was steadily climbing which indicates that there are some memory leaks. Shared Memory remained steady at 12.4 MB. What is the difference between Shared Memory and Memory?
Very concerned about memory usage if the program was to be put under a greater load. Currently the program only handles a single cell from one battery. If that were expanded to cover multiple cells from multiple batteries then the memory usage would likely be enormous.
Estimated memory usage of the program running for over 90 min, with 5 batteries (each containing 16 cells) being covered. Total estimated memory usage is over 1 GB 😱 .
Reran the program after making the modifications to allow multiple cells to be processed. Memory usage of the program running after two hours is around 250 MB with handling 4 batteries (each contains 16 cells). Not as bad as the estimate projected.
Resource usage of the program with CPU (around 2%), and network speeds (up and down).
Looks as though the network connection has failed for some reason:
Copy code
Uncaught Kotlin exception: io.ktor.client.engine.curl.CurlIllegalStateException: Connection failed for request: CurlRequestData(url='<http://xx.xx.xx.xx>:xxxx/write?db=battery_metrics&precision=s', method='POST', content: 55 bytes)
        at kfun:kotlin.Throwable.<init>(kotlin.String?)kotlin.Throwable (0x301d47)
        at kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception (0x2fb655)
        at kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException (0x2fb215)
        at kfun:kotlin.IllegalStateException.<init>(kotlin.String?)kotlin.IllegalStateException (0x2fb7f5)
        at kfun:io.ktor.client.engine.curl.CurlIllegalStateException.<init>(kotlin.String)io.ktor.client.engine.curl.CurlIllegalStateException (0x5ee8a5)
        at kfun:io.ktor.client.engine.curl.internal.CurlMultiApiHandler.readResponseDataFromEasyHandle#internal (0x5f9b63)
        at kfun:io.ktor.client.engine.curl.internal.CurlMultiApiHandler.collectCompleted#internal (0x5f7bd5)
        at kfun:io.ktor.client.engine.curl.internal.CurlMultiApiHandler.pollCompleted(<http://kotlin.Int|kotlin.Int>)kotlin.collections.List<io.ktor.client.engine.curl.internal.CurlResponseData> (0x5f691e)
        at kfun:io.ktor.client.engine.curl.pollCompleted$ktor-client-curl()kotlin.collections.List<io.ktor.client.engine.curl.internal.CurlResponseData> (0x5f2255)
        at kfun:io.ktor.client.engine.curl.CurlProcessor.poll$lambda-7#internal (0x5f14ac)
        at _ZN6Worker19processQueueElementEb (0x66fb40)
        at _ZN12_GLOBAL__N_113workerRoutineEPv (0x67021d)
        at  (0x7fe6e36b86db)
        at clone (0x7fe6e31c988f)
        at  ((nil))
Could the CurlIllegalStateException be related to the memory leaks?