• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quickly activate faceless app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quickly activate faceless app


  • Subject: Re: Quickly activate faceless app
  • From: Keith Alperin <email@hidden>
  • Date: Tue, 2 Jan 2007 22:50:35 -0600

I received the following link from Dan Waylonis describing some mach calls that will wire a process in physical memory:

	http://lists.apple.com/archives/coreaudio-api/2002/Mar/msg00060.html

I was able to use vm_wire like so:

#import <mach/vm_map.h>
...
vm_map_t me = mach_task_self();
kern_return_t code = task_wire(me, true);

if (code == KERN_INVALID_HOST) {
	NSLog(@"vm_wire returned KERN_INVALID_HOST.\n");
} else if (code) {
	NSLog(@"task_wire error code = %d.\n", code);
} else {
	NSLog(@"task_wire(..., true) succeeded.\n");
}

which works like a champ. Now, no matter what else is running, my app's resident memory remains constant at about 40MB. This is a considerable increase from 10, but doesn't seem like an undue amount of memory. Most importantly, I can have XCode, NeoOffice, safari, Mail and iTunes open and my agent will still come forward immediately.

Thanks everyone,
Keith R. Alperin


On Dec 8, 2006, at 6:47 AM, Keith Alperin wrote:

Greetings cocoa-devs!

I have a faceless app (referred to as an Agent Application in the documentation from Apple) which presents a bezel type window when you press a key combination. When I first start the app, the window will come forward immediately upon pressing the hot key. However, after a while of not using it on my poor 768Mb equipped powerbook, the app is relegated to virtual memory and must swap back in order to come forward. This app can be useful at any time and the user experience is completely ruined if the window doesn't appear immediately. Does anyone know of a trick that keep the app resident in memory? When i run top after starting the app, it's only taking up about 10Mb.

Thanks so much!
Keith R. Alperin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: Drawer width problem
  • Next by Date: Compositing a QCView over an NSImageView
  • Previous by thread: Re: Drawer width problem
  • Next by thread: Compositing a QCView over an NSImageView
  • Index(es):
    • Date
    • Thread