Commit 3a442bfa authored by Lysander Trischler's avatar Lysander Trischler

Free memory

parent 9f5ba127
...@@ -93,8 +93,6 @@ _so.parse_file.restype = ParseFileResult ...@@ -93,8 +93,6 @@ _so.parse_file.restype = ParseFileResult
_so.free_twt_file.argtypes = [ctypes.POINTER(_TwtFile)] _so.free_twt_file.argtypes = [ctypes.POINTER(_TwtFile)]
_so.free_twter.argtypes = [ctypes.POINTER(_Twter)]
_so.free_string.argtypes = [ctypes.c_char_p] _so.free_string.argtypes = [ctypes.c_char_p]
...@@ -108,9 +106,7 @@ def parse_file(twtxt_input, twter): ...@@ -108,9 +106,7 @@ def parse_file(twtxt_input, twter):
if result.twtfile is None: if result.twtfile is None:
return None return None
return result.twtfile.contents.to_python() twtfile = result.twtfile.contents.to_python()
#twtfile = TwtFile() _so.free_twt_file(result.twtfile)
#if result.twtfile.contents.twter is not None: return twtfile
# twtfile.twter = result.twtfile.contents.twter.contents.to_python()
#return twtfile
...@@ -98,8 +98,7 @@ func free_string(s *C.char) { ...@@ -98,8 +98,7 @@ func free_string(s *C.char) {
} }
} }
//export free_twter func freeTwter(t *C.struct_twter) {
func free_twter(t *C.struct_twter) {
if t != nil { if t != nil {
free_string(t.nick) free_string(t.nick)
free_string(t.url) free_string(t.url)
...@@ -111,7 +110,11 @@ func free_twter(t *C.struct_twter) { ...@@ -111,7 +110,11 @@ func free_twter(t *C.struct_twter) {
//export free_twt_file //export free_twt_file
func free_twt_file(t *C.struct_twt_file) { func free_twt_file(t *C.struct_twt_file) {
if t != nil { if t != nil {
free_twter(t.twter) freeTwter(t.twter)
if t.twts != nil {
C.free(unsafe.Pointer(t.twts))
}
C.free(unsafe.Pointer(t))
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment