[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Avoiding FFI- allocations + using SSE-vectors
- From: Alex Queiroz <asandroq@...>
- Date: Tue, 7 Feb 2012 11:23:07 +0100
2012/2/6 Adam Strzelecki <email@example.com>:
> Indeed RC requires more care than GC, however Cocoa has nice I clean rules about that, you are responsible for objects returned from +[alloc] and -[copy…] methods or retained via -[retain]. I've just read some news on MacStories that iOS apps crash more often than Android ones, and I believe this may be true. But iOS apps crash, when Android silently leak memory and get sluggish. IMHO as developer I prefer my app to crash, as I can easier spot the problem. (BTW. There is also automatic reference counting ARC in latest iOS)
The use of reference counting does not imply that your application
will always crash instead of slowly leaking memory as well.
> I can just presume regular GC and RC are ok for object with longer lifetime, but both are no good for small temporary objects, such as vectors & matrices that in my case exist only within current scope to provide some temporary buffer for doing some calculation then disappear after being sent to GPU. That's why I think GCC & Clang compilers go further providing vector extensions that treat vectors as primitive types kept on stack. Otherwise CPU would waste most of the time managing memory, copying registers and moving data, and least doing actual calculation.
A generational garbage collector can deal with small, short-lived
objects just fine.