Fix various memory management bugs in GC mode.

This commit is contained in:
gmp
2019-06-27 11:41:58 -04:00
parent b5773b5525
commit acc8cab583
19 changed files with 696 additions and 223 deletions
+4 -5
View File
@@ -1,3 +1,4 @@
// An example of manual memory management (nogc directive in nswrap.yaml)
package main
import "C"
@@ -38,8 +39,6 @@ func memtest1() {
for {
pool := ns.NSAutoreleasePoolAlloc().Init()
o1 := ns.MyClassAlloc()
//If autorelease: true is set in nswrap.yaml, the manual calls to
//autorelease are not necessary.
o1.Autorelease()
o1.DeallocCallback(dealloc)
o1.ReleaseCallback(release)
@@ -133,6 +132,9 @@ func memtest4() {
go memtest1()
go memtest2()
go memtest3()
go memtest1()
go memtest2()
go memtest3()
}
func memtest4a() {
@@ -196,9 +198,6 @@ func main() {
//Within an autorelease pool, do not do anything that can result in a
//switch to a different thread.
//go memtest1()
//go memtest2()
//go memtest3()
go memtest4()
select {}
}
+1
View File
@@ -14,3 +14,4 @@ subclasses:
frameworks:
- Foundation
pragma: [ clang diagnostic ignored "-Wformat-security" ]
nogc: true