question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload via iOS (Kotlin Native/Multiplatform) failed: pointer being freed was not allocated

See original GitHub issue

Ktor Version - 1.2.0 Ktor Engine Used(client or server and name)

  • Multiplatform/Native Client
  • core-iosarm64
  • json-iosarm64
  • ios-iosarm64
  • serialization-iosarm64 Operating System - iOS Request: PUT content-type:  Multipart/form-data Ktor Client Engine: iOS

Tried to upload an image via iOS ktor client and it produces the error shown below. Versions before 1.2.0 works.

iosApp(6943,0x1049d2b80) malloc: *** error for object 0x106794018: pointer being freed was not allocated
iosApp(6943,0x1049d2b80) malloc: *** set a breakpoint in malloc_error_break to debug
 GlobalScope.launch(Dispatchers.Main) {
            try {
                client.submitForm {
                    url("http://192.168.1.47:8000/api/images/")
                    method = HttpMethod.Put
                    header(HttpHeaders.Authorization, "JWT $token")

                    body = MultiPartFormDataContent(
                        formData {
                            append(
                                "image",
                                data,
                                Headers.build {
                                    append(HttpHeaders.ContentType, "image/jpg")
                                    append(HttpHeaders.ContentDisposition, " filename=hello.jpg")
                                }
                            )
                        }
                    )
                }
            } catch (e: Exception){
            }
        }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
e5lcommented, Aug 15, 2019
1reaction
luca992commented, Oct 8, 2019

To save anyone else time… this seems to be fixed on Ktor 1.3.0-beta-1

Read more comments on GitHub >

github_iconTop Results From Across the Web

debugging "pointer being freed was not allocated" errors ...
Another way to do this. Make sure to turn NSZombie on so it reports the memory address of the object that is getting...
Read more >
pointer being freed was not alloca… | Apple Developer Forums
Now sometimes when I move the mouse really fast I get an error "pointer being freed was not allocated" triggered inside drawRect of...
Read more >
Error: pointer being freed was not allocated - Xojo Forum
When I use a larger one (100 lines), and using system.debugLog I can see that it processes the entire file, but then crashes...
Read more >
Kotlin Native
Kotlin Native. Kotlin/Native is a technology for compiling Kotlin code to native binaries which can run without a virtual machine.
Read more >
malloc: *** error for object XXXX: pointer being freed was not ...
I am using https://github.com/miyabi/unity-swift plugin to call a Swift audio conversion method. This is working fine, except that when the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found