Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
chimz
Jul 27, 2005

Science isn't about why, it's about why not.
Check out this guy's post about the cool stuff NSArray does in the background to make things faster and you'll see why reasoning about NSArray and NSSet like they're just simple implementations of arrays and hash tables doesn't always hold true.

http://ridiculousfish.com/blog/archives/2005/12/23/array/

The rest of his blog also has a bunch of interesting discussions about how Cocoa works that are worth a read.

Adbot
ADBOT LOVES YOU

chimz
Jul 27, 2005

Science isn't about why, it's about why not.
NSSet is still probably better than NSArray for doing set type operations i.e. add/remove/contains without ordering. The different interface gives it more freedom to do optimizations in the background. You should use whatever interface most matches the operations you're trying to perform, and let it worry about how to do that most optimally.

edit: quote != edit

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

wwb posted:

This one involves ipv6, ipads and some way to show that you are in fact browsing the internet over this sexy new IPv6 thing.

Can't you use one of those sites that tells you whether you're using ipv6 like http://test-ipv6.com/ and it'll tell you if you're using ipv6?

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Markov Chain Chomp posted:

If I am writing an asynchronous, two-player game like Chess, would it be kosher to use push/APN to alert players that the other player has moved?

Sure. Check out how Words With Friends does it for Scrabble. You're actually not allowed to sit there with an open socket in the background for very long at all, so you should use APN instead. (Go read the docs on iOS multitasking and app backgrounding. It's got a few restrictions you'll need to plan for. )

Also I think there is turn-based game support in Game Center for iOS 5, so you should look that up if you're interested.

Markov Chain Chomp posted:

Also, if I wanted to make sure that the only thing connecting to my backend is my app, is there a reasonable way of doing so?

You can use a password or a certificate or something to impede hackers, but it's basically impossible to be totally sure that your app is intact. You should always put all verification and game rule code etc on the server side.

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Ender.uNF posted:

Ever since I upgraded to 10.9, any time my system goes to sleep long enough to hibernate, it will fail to wake from hibernation.

You should either a) call AppleCare or b) file a bug at https://bugreport.apple.com with the file generated from 'sudo sysdiagnose' run on the command line.

If you're feeling masochistic, you might be able to see those logs using firewire debug logging:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/fwkpfv.1.html

Do you have anything attached to the system while it's sleeping?

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Doctor w-rw-rw- posted:

NSNumbers below 100 are cached/deduplicated, if memory serves, since they're pretty common.

They're tagged pointers now:
https://www.mikeash.com/pyblog/friday-qa-2012-07-27-lets-build-tagged-pointers.html
http://objectivistc.tumblr.com/post/7872364181/tagged-pointers-and-fast-pathed-cfnumber-integers-in

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Ender.uNF posted:

This all started when I wanted to figure out how the hell a 32 bit kernel could possibly support 64 bit user mode software since calls into 32 bit kernel land can't read any data via 64 bit pointers, since the transition kicks back down to 32 bit mode. The solution would be to map that 64 bit virtual address into the kernel's 32 bit address space so you have both a 32 and 64 bit pointer to the same physical memory. How that would work practically is unknown though.

It's not impossible, just very tricky. IIRC what happens is that all traps to the kernel save the register state, switch to the kernel's separate address space and into 32-bit mode, and then continue on with kernel operations. All kernel-to-user memory access is mediated through the 'copyin' and 'copyout' kernel functions (man 9 copyin), which can remap the relevant user memory into a temporary mapping in the kernel so it can be copied into a kernel buffer. The 32-bit kernel still has to understand 64-bit userspace pointers, but it never actually dereferences them. It's not essential to have the kernel reserve some part of the user address space, it's just more efficient to do it that way so you don't have to do the remapping dance.

:eng101:

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Doctor w-rw-rw- posted:

Interesting. What is the varargs change? Please do elaborate.

This one?

"The iOS ABI for functions that take a variable number of arguments is entirely different from the generic version."

https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html

chimz
Jul 27, 2005

Science isn't about why, it's about why not.
(Lowtax said I hit the post rate limit. Apparently the post actually went through.)

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

lord funk posted:

Triggered by Thread: 9

You posted thread 0, not thread 9 - are you sure that's where the actual problem is?

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Ender.uNF posted:

Oh and side note: I now have to shutdown my laptop every time I'm done using it. No matter what I do I can't fix the failure to wake problem. Disabling TRIM and swapping back to the spinning disk that came with it had no effect, despite Apple closing my radar due to third party hardware. Re-confirmed my previous experience that filing radars is a waste of time/energy. Never was able to get anyone to tell me how to enable logging of hibernate restores on systems without a serial port, they just closed it immediately.

Rumor has it that a firewire-thunderbolt adapter can do it:
http://prod.lists.apple.com/archives/darwin-kernel/2014/Jan/msg00002.html
https://twitter.com/pmjordan/status/413157837896835072

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Ender.uNF posted:

Anyone have pointers to some docs on debugging semaphore or GCD deadlocks?

Semaphores don't have owners like mutexes do - there might be some code that will signal the semaphore in the future, but the semaphore doesn't really know about it. A mutex does know what thread owns it - you can't unlock a mutex from a different thread than the one that locked it, unlike a semaphore.

One of the fields in the pthread mutex structure is a thread ID - which is the same hex number identifier that shows up in LLDB/Xcode/spindump/sample/etc.

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

pokeyman posted:

This isn't my app and I'm not trying to fix it or anything, I'm just curious about what might be happening behind the scenes.

That's a low memory log - the OS has run out of memory and had to kill a visible app to keep the system alive. When it does this, it logs out the memory usage of the system daemons and the app so you (and Apple) can see where memory was being used.

Showing up consistently while launching a specific app but then fixing itself on reboot might mean that some critical system process is using too much memory and isn't freeing it up when it's supposed to, so there's less memory available for the foreground app to use before the system runs out. That app in particular requires more than most, and it ends up going over the limit.

Clearly that's not supposed to happen.. Can you post the whole log?

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

fritz posted:

..../System/Library/Frameworks/Kernel.framework/Versions/A/Headers/AssertMacros.h defines check(), I assume it's getting included somewhere along the line.

Kernel.framework is for kexts. You're probably getting /usr/include/AssertMacros.h instead.

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

hackbunny posted:

Hate to spam the thread, but what is this poo poo?

Xcode's code signature is breaking due to touching your incorrectly signed code - see if you can resign your app and/or analyze it with codesign to see what's wrong.
Xcode crashes because it's entitled to do things and with that comes the bit that says 'kill me if I touch wrongly signed code'.

Xcode is supposed to be more careful when it debugs another app in order to not get its code signature screwed up, feel free to file a bug: https://bugreport.apple.com

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

Doctor w-rw-rw- posted:

Anyone have good advice on how to get into kernel programming? I've grokked a little bit of Mach IPC, but want to learn the other deep stuff that makes xpc (and others) tick.

Is there some specific technology you're exited about? There's an almost infinite depth of complexity when diving into operating systems, it helps to have some small piece to pick apart.
XPC is built on top of Mach IPC and libdispatch - there's no extra kernel magic going on.
However, XPC is going to be more difficult for you to investigate because it isn't open source.

Here's some books on the lower layers of OS X: this one is pretty old school (10.4) but covers a lot of in-depth kernel stuff:
http://osxbook.com

and this one is supposedly more up to date, but I haven't read it yet:
http://newosxbook.com

Adbot
ADBOT LOVES YOU

chimz
Jul 27, 2005

Science isn't about why, it's about why not.

status posted:

The vast majority of my apps have started crashing on launch.

Some steps to try fixing it:

a) reboot your phone (hold power, slide to shutdown, or just hold power+home)
b) sign out and in to the iTunes store, and download a free app or something, to kick Fairplay into redownloading the app decryption key database.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply