Re: a way to clear inactive RAM
Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Thanks again, Nick On 06-Nov-2012, at 2:29 AM, Alex Zavatone z...@mac.com wrote: Not sure what RAM clearing means but if you want to purge the disk cache, check out man purge in the terminal. On Nov 5, 2012, at 1:54 PM, Nick Rogers wrote: Hi, I am assigned this small utility which should clear inactive RAM. I know Mac OS X manages memory quite efficiently and inactive RAM also has a purpose. But I have to make this. Prior to Mountain Lion I was allocating memory in my app that was roughly equivalent to free + inactive RAM. And it used to work perfectly, i.e. most inactive RAM used to become free. But in Mountain Lion, aggressive allocations are not affecting RAM at all. I want this util to also work on systems that don't have Xcode installed. I saw the post where someone posted notes of purge disassembly. But that isn't leading anywhere. Also purge comes with Xcode only. There are apps on Mac App Store that do this kind of thing. How to go about it? Any pointers would be really appreciated. Wishes, Nick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On 6 Nov 2012, at 11:01, Nick Rogers roger...@mac.com wrote: Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Why on earth would you want to release inactive memory? This is memory that is in use by applications, just ones that haven't been scheduled in for a while. This RAM IIRC is automatically paged out to disk, so that if it is needed it can simply be overwritten, just like free memory, but has the side benefit that if it's not overwritten, then the inactive applications can be brought back to life very fast. Freeing it all would not gain anything, but would cause inactive apps to take much longer to return to the foreground. As an aside - free memory is a bad thing – having free memory means your system is not using all the RAM it has available to make things nice and fast. I fully expect my machine to use free memory for things like disk caches if I currently do not need the RAM for applications. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Coordinating animation of layers with a UIView animation
I have a UIView which frame I am animating to a new location/size using [ UIView animateWithDuration:animations ]. The view's layer has a custom sublayer which it's laying out either in layoutSubviews or layoutSublayersOfLayer:, either seems to work. That sublayer is also moving to a new position depending on the new UIView bounds. What I want is the two animations to go together, using whatever the duration set in the UIView's animateWithDuration:animations: call because that is the point at which I know how long the animation needs to be. The only way I've found to do this so far seems really hacky, to nest a CATransaction within the UIView animation and give them the same time, is there a better way to accomplish something like this? NSTimeInterval interval = 2f; [ UIView animateWithDuration:interval animations:^{ [ CATransaction begin ]; [ CATransaction setAnimationDuration:interval ]; self.faceView.frame=faceViewFrame; [ CATransaction commit ]; } ]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Coordinating animation of layers with a UIView animation
After setting up your UIView animation, you can introspect the animation timing by looking at the respective view's layer.animations. Your can then apply that animation to your sublayer. For bonus points, just start using a subview instead of a sublayer :) Luke On Nov 6, 2012, at 5:09 AM, Roland King r...@rols.org wrote: I have a UIView which frame I am animating to a new location/size using [ UIView animateWithDuration:animations ]. The view's layer has a custom sublayer which it's laying out either in layoutSubviews or layoutSublayersOfLayer:, either seems to work. That sublayer is also moving to a new position depending on the new UIView bounds. What I want is the two animations to go together, using whatever the duration set in the UIView's animateWithDuration:animations: call because that is the point at which I know how long the animation needs to be. The only way I've found to do this so far seems really hacky, to nest a CATransaction within the UIView animation and give them the same time, is there a better way to accomplish something like this? NSTimeInterval interval = 2f; [ UIView animateWithDuration:interval animations:^{ [ CATransaction begin ]; [ CATransaction setAnimationDuration:interval ]; self.faceView.frame=faceViewFrame; [ CATransaction commit ]; } ]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
Again, if you want to clear cached memory on disk, issue a shell purge. All that other memory is being used for something. On Nov 6, 2012, at 6:01 AM, Nick Rogers wrote: Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Thanks again, Nick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
Le 6 nov. 2012 à 12:13, Tom Davie tom.da...@gmail.com a écrit : On 6 Nov 2012, at 11:01, Nick Rogers roger...@mac.com wrote: Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Why on earth would you want to release inactive memory? This is memory that is in use by applications, just ones that haven't been scheduled in for a while. This RAM IIRC is automatically paged out to disk, so that if it is needed it can simply be overwritten, just like free memory, but has the side benefit that if it's not overwritten, then the inactive applications can be brought back to life very fast. The memory is paged out to disk only if it is read-write memory that was modified, and is not already on the disk. All mapped frameworks, the full content of the Unified Buffer Cache (which generally represent most of the inactive memory) and other stuff are keep in RAM to provide faster access, but are already present on disk and will be simply discarded if the system need more RAM. So not only freeing inactive memory is useless, but it is also guarantee to make your system slower. Freeing it all would not gain anything, but would cause inactive apps to take much longer to return to the foreground. As an aside - free memory is a bad thing – having free memory means your system is not using all the RAM it has available to make things nice and fast. I fully expect my machine to use free memory for things like disk caches if I currently do not need the RAM for applications. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to devli...@shadowlab.org -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sorting NSTableView using Bindings
On Nov 5, 2012, at 7:32 PM, Ken Thomases k...@codeweavers.com wrote: Not to my knowledge. Bindings don't provide a way to specify the initial sort. Bindings are nice, but they're not intended to entirely eliminate the need to write code. I think they were, but they just don't do a very good job. ;-) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 9:23 AM, Jean-Daniel Dupas wrote: Le 6 nov. 2012 à 12:13, Tom Davie tom.da...@gmail.com a écrit : On 6 Nov 2012, at 11:01, Nick Rogers roger...@mac.com wrote: Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Why on earth would you want to release inactive memory? This is memory that is in use by applications, just ones that haven't been scheduled in for a while. This RAM IIRC is automatically paged out to disk, so that if it is needed it can simply be overwritten, just like free memory, but has the side benefit that if it's not overwritten, then the inactive applications can be brought back to life very fast. The memory is paged out to disk only if it is read-write memory that was modified, and is not already on the disk. All mapped frameworks, the full content of the Unified Buffer Cache (which generally represent most of the inactive memory) and other stuff are keep in RAM to provide faster access, but are already present on disk and will be simply discarded if the system need more RAM. So not only freeing inactive memory is useless, but it is also guarantee to make your system slower. Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. OK, yes, it will be slower, but it might not be noticeable. And from what I've seen, many web site creators aren't treating each of their pages as if they should be memory controlled. Turning off JavaScript certainly prevents much of this bloat. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 7:08 AM, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB If that actually gets you back memory, it’s just because Safari has marked some of its allocated address space as ‘purgeable’. You would have gotten that space back if it became necessary anyway, without the need to do anything explicit, because the kernel will start tossing out purgeable address space as needed to free up space for new allocations. The basic principle is, don’t second-guess the kernel, at least not unless you know its architecture really well or have read through Singh’s “Mac OS X Internals” book :) In my experience, Activity Monitor’s pie charts of system memory usage are nice as blinkenlights but nearly useless for any practical purpose of mine. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 3:01 AM, Nick Rogers roger...@mac.com wrote: I was trying to achieve what essentially free memory apps on the Mac AppStore do. Those apps are useless, except as revenue generators for their authors. When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. That doesn’t serve any useful purpose (it just slows down the OS), _unless_ you are trying to profile a cold launch of an app at system startup, i.e. see how your app performs when none of its code or data are possibly still cached. And in that case the ‘purge’ command will do the job. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On 6 Nov 2012, at 11:30 AM, Jens Alfke j...@mooseyard.com wrote: On Nov 6, 2012, at 7:08 AM, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB If that actually gets you back memory, it’s just because Safari has marked some of its allocated address space as ‘purgeable’. You would have gotten that space back if it became necessary anyway, without the need to do anything explicit, because the kernel will start tossing out purgeable address space as needed to free up space for new allocations. The basic principle is, don’t second-guess the kernel, at least not unless you know its architecture really well or have read through Singh’s “Mac OS X Internals” book :) In my experience, Activity Monitor’s pie charts of system memory usage are nice as blinkenlights but nearly useless for any practical purpose of mine. I understand that this is what is supposed to happen, and I do believe that smart people with good intentions have worked to make it happen. But it often happens that when Activity Monitor's pie chart shows no free RAM, my computer becomes sluggish. It rarely happens that when my computer is sluggish, Activity Monitor shows free RAM. It's not 1:1, and maybe I'm a victim of confirmation bias, but that's my experience. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 8:08 AM, Alex Zavatone z...@mac.com wrote: On Nov 6, 2012, at 9:23 AM, Jean-Daniel Dupas wrote: Le 6 nov. 2012 à 12:13, Tom Davie tom.da...@gmail.com a écrit : On 6 Nov 2012, at 11:01, Nick Rogers roger...@mac.com wrote: Hi, Thanks for the replies. I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. 1. Free 2. In-active 3. Active 4. Wired When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free. e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB. Why on earth would you want to release inactive memory? This is memory that is in use by applications, just ones that haven't been scheduled in for a while. This RAM IIRC is automatically paged out to disk, so that if it is needed it can simply be overwritten, just like free memory, but has the side benefit that if it's not overwritten, then the inactive applications can be brought back to life very fast. The memory is paged out to disk only if it is read-write memory that was modified, and is not already on the disk. All mapped frameworks, the full content of the Unified Buffer Cache (which generally represent most of the inactive memory) and other stuff are keep in RAM to provide faster access, but are already present on disk and will be simply discarded if the system need more RAM. So not only freeing inactive memory is useless, but it is also guarantee to make your system slower. Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. Memory remains the target of much superstition. The OS will take care of managing memory--you don't need to do it. Common utilities like Activity Monitor and Task Manager have given micro-managing users an excuse to second-guess their OS, which is rarely wise. Preston ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Extremely low fps during transparent NSWindow resize
On Nov 5, 2012, at 5:39 PM, Kyle Sluder wrote: On Mon, Nov 5, 2012, at 02:20 PM, Andrea3000 wrote: Since I still have a Snow Leopard partition I have access to QuartDebug 4.1 and the hidden setting you suggested works as expected. The strange thing is that while regular windows like Safari, Mail, ecc, are all opaque except for the corners (as pointed out in the previous mail), Quick Time Player X window is fully transparent! So the question is still open. How can Quick Time Player X be so fast during resize if it is an all transparent window? What if you take a hint from what Quartz Debug is telling you about standard system windows, and instead of using an NSBezierPath (which you are currently redrawing in its entirety on every frame of a drag), you fill your window using three large rectangles and four half-arcs? It's worth trying, but I don't think that's what is meant when Quartz Debug says a region of a window is transparent. It has nothing to do with how it's been drawn. It has to do with what the window server has been told about which parts of the window are non-opaque. -[NSWindow setOpaque:NO] tells the window server that no part of the window is opaque, so it has to composite the whole window, even if, in reality, most of the window is filled with opaque color. I've tried what Kyle suggested but unfortunately it didn't change the behavior. This issue can be reproduced with a bog-standard Cocoa app. Just add [window setOpaque:NO] to the -applicationDidFinishLaunching: method in a standard app template and you get the problem. This is without any drawing (other than the window's own background color, which I'm leaving at the default) by any views. Exactly, I also discovered the same results while I was investigating this issue quite a year ago on this list (http://lists.apple.com/archives/cocoa-dev/2012/Feb/msg00723.html). I suspect that QuickTime Player X is using private interfaces to tell the window server that specific window regions (the four corners) are non-opaque. I really hope there is a way to obtain good resizing performance without using private API. Is there a way to determine which special methods does Quick Time Player X call during window setup and/or composite? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 1:13 PM, William Sumner wrote: On Nov 6, 2012, at 8:08 AM, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. Memory remains the target of much superstition. The OS will take care of managing memory--you don't need to do it. Common utilities like Activity Monitor and Task Manager have given micro-managing users an excuse to second-guess their OS, which is rarely wise. Preston The only reason I resorted to this was because of performance issues. If Safari is running, and a large amount of memory is used up, it's most likely in pages or images that are running in Safari that are behind what I am looking at. Many might be images that have come and gone that are not needed by pages any more, but according to the memory model, they are still needed. But, as the user of the system, I don't care, unless Safari is in the foreground and I am looking at the page/tab which needs allocated items. This is where a purge is useful. I'm telling the system to push away the items that I don't care about. At times, I have tested issuing a SIGSTOP and a SIGCONT to Safari as the app goes to the goes to the background and comes to the front and simply by pausing the app, performance on my system (quad core i7 MBP, 16 GB RAM, 480 GB SSD) improves. The GUI becomes more snappy. This also happens when temporarily disabling JavaScript. Also, there is some interaction between dock widgets and Safari that I don't understand that is related to performance and memory where if I kill the dock, performance of the whole system picks up and the Activity Monitor blinkenlights memory readout frees up a few gig. In fact I just issued a purge and got about a gig back from Safari. Sure, it's running and items are allocated as being used, but all of that isn't needed at once. I find that, at least when Safari and webkit is involved, the OS's memory management doesn't take in to effect that many of the opened windows and tabs do not need to have the same high priority as other applications and memory management doesn't handle making non front pages and tabs second class citizens fast enough. Just my experience though. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 1:05 PM, Fritz Anderson wrote: On 6 Nov 2012, at 11:30 AM, Jens Alfke j...@mooseyard.com wrote: On Nov 6, 2012, at 7:08 AM, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB If that actually gets you back memory, it’s just because Safari has marked some of its allocated address space as ‘purgeable’. You would have gotten that space back if it became necessary anyway, without the need to do anything explicit, because the kernel will start tossing out purgeable address space as needed to free up space for new allocations. The basic principle is, don’t second-guess the kernel, at least not unless you know its architecture really well or have read through Singh’s “Mac OS X Internals” book :) In my experience, Activity Monitor’s pie charts of system memory usage are nice as blinkenlights but nearly useless for any practical purpose of mine. I understand that this is what is supposed to happen, and I do believe that smart people with good intentions have worked to make it happen. But it often happens that when Activity Monitor's pie chart shows no free RAM, my computer becomes sluggish. It rarely happens that when my computer is sluggish, Activity Monitor shows free RAM. It's not 1:1, and maybe I'm a victim of confirmation bias, but that's my experience. — F Exactly the same condition happens here, which is why I ended up resorting to the purge command. Most (all) of the memory bloat and performance problems that come with it that I have on my system is due to Safari and I've narrowed it down to a few things previously mentioned. If only I could get in the habit of using another browser. Even with disabling Flash and as many superfluous graphics, it's still the #1 memory pig on my system. Disabling Javascript certainly helps. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On 06.11.2012, at 12:01, Nick Rogers roger...@mac.com wrote: I was trying to achieve what essentially free memory apps on the Mac AppStore do. The RAM usage can be divided into four parts as shown in Activity Monitor. You're aware that those applications are snake oil, right? There is no practical benefit to clearing free RAM. It will actually make things slower. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On 06.11.2012, at 16:08, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. Err ... if I understand correctly, you're nuking the caches used by the system and other applications to compensate for the problem that Safari, when left open, leaks like a sieve ... ? Those two things are orthogonal. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
Well, yes, maybe. If the Mac is booted from an SSD, and the system performance starts to lag or memory starts to get full, I'll gladly purge the cache since paging out to SSD again isn't as much of a time consuming task. If I were able to target Safari and its processes (WebProcess), then I'd do that. Actually, I don't think that what I'm seeing are Safari/Webkit leaks - unless you know otherwise. I think the people who are creating pages that are loaded in Safari are the villains and are not freeing up allocated variables, but I have gotten particular pages in Safari where certain operations are blocking the thread and as soon as that page is closed, my whole system becomes snappier. In my cursory understanding of what's going on beneath the hood, that shouldn't happen at all but it does. I've never seen FireFox, Camino or Chrome crater the performance of my Mac like Safari does but, I agree, this is outside of the original discussion. Ideally when this happens, I'd love to save my list of pages I'm interested in and either restart Safari with only those URLs, or fire up another browser and load that list of URLs in a queue. On Nov 6, 2012, at 2:41 PM, Uli Kusterer wrote: On 06.11.2012, at 16:08, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. Err ... if I understand correctly, you're nuking the caches used by the system and other applications to compensate for the problem that Safari, when left open, leaks like a sieve ... ? Those two things are orthogonal. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 12:58 PM, Alex Zavatone wrote: Ideally when this happens, I'd love to save my list of pages I'm interested in and either restart Safari with only those URLs Close the pages you're not interested in, quit Safari, launch Safari, choose History - Reopen All Windows from Last Session. Unless of course pages you're interested in include ones where you've had to log in to the site... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 3:25 PM, Jack Carbaugh intrn...@me.com wrote: Facebook is a safari killer. if left open, it will bring down a system. And by bring down I mean, make it so unresponsive that the only option is a forced reboot via power button. It happened everyday on my other half's clean system, until i set up automatic log off. (He could never remember to just close the tab.) On Nov 6, 2012, at 2:41 PM, Uli Kusterer witness.of.teacht...@gmx.net wrote: On 06.11.2012, at 16:08, Alex Zavatone z...@mac.com wrote: Actually, that's not always the case. As I use Safari through out the day, Safari ends up eating 6 to 12 GB of data on my 16 GB system. Frequently, I need to issue a purge to get back a spare GB or few hundred MB. Plus, if you're booting off, or have your swap file on an SSD disk related performance penalties will be much less than if using an HD to hold the swap file. Err ... if I understand correctly, you're nuking the caches used by the system and other applications to compensate for the problem that Safari, when left open, leaks like a sieve ... ? Those two things are orthogonal. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.masters-of-the-void.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/intrntmn%40aol.com This email sent to intrn...@aol.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
Facebook is a safari killer. if left open, it will bring down a system. And by bring down I mean, make it so unresponsive that the only option is a forced reboot via power button. It happened everyday on my other half's clean system, until i set up automatic log off. (He could never remember to just close the tab.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: a way to clear inactive RAM
On Nov 6, 2012, at 11:58 AM, Alex Zavatone z...@mac.com wrote: Ideally when this happens, I'd love to save my list of pages I'm interested in and either restart Safari with only those URLs, or fire up another browser and load that list of URLs in a queue. Uh, you do realize in Lion and later, this is supported as application restore? Something happened around the Safari 6.0 release which caused this piggy behavior. Sometimes Safari crashes, and sometimes I just quit it and start over. This lasts about a day or so with nothing else happening—especially without plugins or Java activated. Really, that's the only way to fix this without actually fixing Safari. Otherwise, keep submitting bugs to Apple. Hopefully someone will do something. -- Gary L. Wade (Sent from my iPhone) http://www.garywade.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Harnessing Perl Scripts within a Project
On 06/11/2012 00:47, Jens Alfke wrote: One compromise you might consider is using Ruby, which has pretty decent integration with Cocoa. (Ditto for Python, but Ruby is more Perl-esque.) It’s possible to write Cocoa apps entirely in those languages. Thank you. The Ruby option does look rather attractive especially since I could learn Ruby in quite a short time and at the end of it be as happy writing Ruby code as Perl code. At the same time I think I get the message that I’d do best to struggle on with Objective-C and see if my aversion lessens. Thank you all for your advice. JD ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Harnessing Perl Scripts within a Project
On 07/11/2012, at 10:45 AM, John Delacour j...@bd8.com wrote: On 06/11/2012 00:47, Jens Alfke wrote: One compromise you might consider is using Ruby, which has pretty decent integration with Cocoa. (Ditto for Python, but Ruby is more Perl-esque.) It’s possible to write Cocoa apps entirely in those languages. Thank you. The Ruby option does look rather attractive especially since I could learn Ruby in quite a short time and at the end of it be as happy writing Ruby code as Perl code. At the same time I think I get the message that I’d do best to struggle on with Objective-C and see if my aversion lessens. I'm curious - isn't the fact that none of those languages support true multithreading a rather big hindrance when programming a Cocoa Application? How would you put together a responsive application without it? I used to do perl for a living, and to my knowledge multithreading was never bug-free and functional. Ruby and python are exactly the same - they all support forking new processes a-la UNIX style, but no real OS-level threads (IIRC, both ruby and python, in all their implementations but the java-based ones include a big mutex.) Has this changed? Or is there a way around it? Thanks, -- ank ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Strange event result
Hi all, Following up on a problem I was having a week or so back with receiving multiple mouse-ups in an event loop, I've narrowed the problem down to the events coming from a trackpad instead of a mouse. Here's an odd thing: NSUInteger mask = NSLeftMouseDownMask | NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSMouseMovedMask | NSScrollWheelMask | NSKeyDownMask; while( loop ) { theEvent = [NSApp nextEventMatchingMask:mask untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; This is the fragment of code that sets up the mask and grabs the event. I should only get those events that match the mask, right? With a mouse, I do, but with a trackpad I'm also getting right mouse down, right mouse dragged and right mouse up returned. Is that expected? It seems incorrect. I'm not sure it has a bearing on my bug because I do ignore those events, but OTOH, the bug is only manifest using the trackpad. (Debugging this in the debugger is impossible due to the dynamic nature of the loop, so I'm having to try and log output at key points). --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Strange event result
It's looking strongly like a bug in the OS or trackpad driver, and it appears that the additional unexpected events, while odd, are not a direct cause of the bug I have. I'm responding to 4 event types: LDown, LUp, LDragged and Moved. I expect Down-Dragged-Up-Moved-Down-Dragged-Up-Moved, etc. which is what I get reliably from a mouse. With the trackpad, I also get this most of the time, but sometimes it goes directly from moved to dragged without a mouse down, and vice versa sometimes with and without a mouse up. e.g. Down-Dragged-Up-Moved-Dragged-Moved-Dragged-Up-Moved... The missing mouse-downs are a problem because my code uses that to advance the state of a state machine, and because that's not happening it isn't working properly. There is a very distinct click of the trackpad's button, but no mouse-down gets delivered. The dragging finger generally remains on the trackpad while I click or release the trackpad's mouse button. Again, this seems incorrect to me - the button clicking should ALWAYS send a mouse down and mouse up no matter what other fingers are doing. I have turned off all the fancy gesture detection in system prefs, but that made no difference. This is very frustrating because there's probably little I can do in my code to workaround this. I'm going to try setting a flag that means expect a mouse down and if I get a drag instead, treat the first drag event as a mouse down. That might work around it but it's pretty poor that the system really isn't working as it should. Surely others have noticed this? I would have thought mouse downs going missing in a view would be a pretty obvious bug. --Graham On 07/11/2012, at 11:08 AM, Graham Cox graham@bigpond.com wrote: Hi all, Following up on a problem I was having a week or so back with receiving multiple mouse-ups in an event loop, I've narrowed the problem down to the events coming from a trackpad instead of a mouse. Here's an odd thing: NSUInteger mask = NSLeftMouseDownMask | NSLeftMouseUpMask | NSLeftMouseDraggedMask | NSMouseMovedMask | NSScrollWheelMask | NSKeyDownMask; while( loop ) { theEvent = [NSApp nextEventMatchingMask:mask untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]; This is the fragment of code that sets up the mask and grabs the event. I should only get those events that match the mask, right? With a mouse, I do, but with a trackpad I'm also getting right mouse down, right mouse dragged and right mouse up returned. Is that expected? It seems incorrect. I'm not sure it has a bearing on my bug because I do ignore those events, but OTOH, the bug is only manifest using the trackpad. (Debugging this in the debugger is impossible due to the dynamic nature of the loop, so I'm having to try and log output at key points). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Harnessing Perl Scripts within a Project
On 11/6/12, John Delacour j...@bd8.com wrote: On 06/11/2012 00:47, Jens Alfke wrote: One compromise you might consider is using Ruby, which has pretty decent integration with Cocoa. (Ditto for Python, but Ruby is more Perl-esque.) It’s possible to write Cocoa apps entirely in those languages. Thank you. The Ruby option does look rather attractive especially since I could learn Ruby in quite a short time and at the end of it be as happy writing Ruby code as Perl code. At the same time I think I get the message that I’d do best to struggle on with Objective-C and see if my aversion lessens. As a former Perl guru (in another life), I can empathize with getting stuff done in higher level languages. But when dealing with the native OS, Objective-C/Cocoa is the best way to get stuff done on Mac, particularly with UI. That is what led me to Lua. Lua is a great language in that it focuses on what it wants to do and doesn't try to do everything. Lua is then is designed to be embedded in a bigger application so you can pick the right tool/language for the task. And this is what led me to write LuaCocoa to make it even easier to cross between Obj-C/Lua, thus letting you divide up your app so you can write each component in the language you feel is most effective. http://playcontrol.net/opensource/LuaCocoa/ Also, nobody mentioned CamelBones (the Perl/Obj-C bridge). Sadly, I read that the author Sherm Pendley passed away suddenly/unexpectedly a few years ago. -Eric -- Beginning iPhone Games Development http://playcontrol.net/iphonegamebook/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Harnessing Perl Scripts within a Project
On Nov 6, 2012, at 4:03 PM, Andres Kievsky a...@a2apps.com.au wrote: I'm curious - isn't the fact that none of those languages support true multithreading a rather big hindrance when programming a Cocoa Application? How would you put together a responsive application without it? Threading isn’t mandatory. Most of the slow stuff like network I/O can be done with asynchronous APIs. (On the other hand, my app development has been done on Mac OS, not iOS, and I know iOS devices have a lot fewer CPU cycles to throw around…) Anyway, if responsiveness is a concern, you probably don’t want to be coding in any interpreted language! Back in the day (1998-2000) my team and I were struggling to get Java to perform well compared to native apps, and even back then Java had considerably better performance than purely interpreted ‘scripting’ languages. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Harnessing Perl Scripts within a Project
In fact it is very possible to effectively bridge Perl and Cocoa objects since Perl embeds very nicely in multi-threaded C based parents. Apple provides (provided?) a fairly good bridge but it has some leaks isn't well maintained. There is also CamelBones as mentioned. I wrote my own that has full KVO and bindings support and while it may be open sourced one day it's not too hard to achieve the basics like calling functions and methods. (Having said that, while there's nothing too complex about it, without a thorough understanding of C you will struggle, but then you're going to want that to become a productive Cocoa developer anyway). Take a look at perlcall and perlembed http://perldoc.perl.org/perlcall.html http://perldoc.perl.org/perlembed.html and feel free to ping me with any questions. -- Mark Aufflick http://mark.aufflick.com/about/contact http://pumptheory.com/about On Wed, Nov 7, 2012 at 1:19 PM, Jens Alfke j...@mooseyard.com wrote: On Nov 6, 2012, at 4:03 PM, Andres Kievsky a...@a2apps.com.au wrote: I'm curious - isn't the fact that none of those languages support true multithreading a rather big hindrance when programming a Cocoa Application? How would you put together a responsive application without it? Threading isn’t mandatory. Most of the slow stuff like network I/O can be done with asynchronous APIs. (On the other hand, my app development has been done on Mac OS, not iOS, and I know iOS devices have a lot fewer CPU cycles to throw around…) Anyway, if responsiveness is a concern, you probably don’t want to be coding in any interpreted language! Back in the day (1998-2000) my team and I were struggling to get Java to perform well compared to native apps, and even back then Java had considerably better performance than purely interpreted ‘scripting’ languages. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/mark-cocoa%40aufflick.com This email sent to mark-co...@aufflick.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CALayer still has no constraints on iOS
And not even custom layout managers. I can imagine not having wanted to support the constraint layout originally for performance reasons, but custom layout managers are going to be exactly the same overhead as fully custom code, but nicely abstracted and consistent. -- Mark Aufflick http://mark.aufflick.com/about/contact http://pumptheory.com/about On Wed, Oct 31, 2012 at 4:22 AM, Matt Neuburg m...@tidbits.com wrote: I find it odd that UIView on iOS now has the wonderful CALayoutConstraint system, but CALayer doesn't have anything analogous. This means that a sublayer - that is, a sublayer of a view's layer - just sits there like a bump on a log when the view is resized. To give an example, Apple has made it clear in the WWDC videos that they would like me to support rotation in table views. But let's say that part of how I was drawing my UITableViewCell was with sublayers. When we rotate and the cell gets wider, the sublayer doesn't get wider. Now, it's not as if I don't see any way out of this. I can probably pretty much do with subviews what I was doing with sublayers, and thus get all the layout constraint's yummy goodness. I'm just surprised that we still have no form of auto-resizing for sublayers, and I'm wondering if I'm missing something. m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/mark-cocoa%40aufflick.com This email sent to mark-co...@aufflick.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com