Interop/Indexer: improve memory management
This commit is contained in:
+2
-1
@@ -105,7 +105,7 @@ private class NativeIndexImpl : NativeIndex() {
|
|||||||
CXCursorKind.CXCursor_UnionDecl -> return false
|
CXCursorKind.CXCursor_UnionDecl -> return false
|
||||||
|
|
||||||
CXCursorKind.CXCursor_StructDecl -> {
|
CXCursorKind.CXCursor_StructDecl -> {
|
||||||
val hasAttributes = malloc(Int32Box)
|
val hasAttributes = arena.alloc(Int32Box)
|
||||||
hasAttributes.value = 0
|
hasAttributes.value = 0
|
||||||
clang_visitChildren(structDefCursor, { cursor, parent, clientData ->
|
clang_visitChildren(structDefCursor, { cursor, parent, clientData ->
|
||||||
if (clang_isAttribute(cursor.kind.value) != 0) {
|
if (clang_isAttribute(cursor.kind.value) != 0) {
|
||||||
@@ -264,6 +264,7 @@ fun CXString.convertAndDispose(): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun buildNativeIndexImpl(headerFile: File, args: List<String>): NativeIndex {
|
fun buildNativeIndexImpl(headerFile: File, args: List<String>): NativeIndex {
|
||||||
|
// TODO: dispose all allocated memory and resources
|
||||||
val args1 = args.map { CString.fromString(it)!!.asCharPtr() }.toTypedArray()
|
val args1 = args.map { CString.fromString(it)!!.asCharPtr() }.toTypedArray()
|
||||||
|
|
||||||
val index = clang_createIndex(0, 0)
|
val index = clang_createIndex(0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user