[iphone sdk] memory allocations and application sandboxing

folks,
does the os automatically de-allocate any memory allocated when my app exists? reason i ask is the phone seems to get slower and slower over time with more crashes. a hard restart seems to fix the problem.
i'm guessing that it is because i'm not cleaning things up on exit or something, but maybe there is something else wrong.
john

The academic answer is: It shouldn't matter how much memory you leak in your app after the app has been closed. I can't speak to how the device functions cause I can't test on one yet! But it's UNIX under the hood and that means each process is assigned it's own address space. Any memory allocated to a process is completely reclaimed when the process exits.
I'm not sure what changes Apple made to the VM kernel subsystem for the iPhone. Unix is already tried and tested in this arena -- so if it's the default Darwin VM I would be very surprised if this is a bug. But since this is embedded they may have added some "shortcuts" for performance and efficiency... hard to say. Since you have the device, are you able to do any system level diagnostics? does the device lose free memory the more your start/stop your app?
Also -- the device has 128MB of RAM. The 8 or 16GB is storage, which isn't used for RAM. The specs are hard to find, but I think I found the answer through Google on the amount of RAM in the iPhone and iPod Touch.
Cheers,
George

Similar Messages

  • Large iPhone "Other" Memory Allocation

    My iPhone 4 (iOS 5.1) is showing that I have 0.80GB of memory allocated to "other."  I only have 0.17 GB of audio, 0.39 GB of apps, and 1.38 GB in photos (over iCloud) on it at this time.  I've cleared call and web history, texts, cookies, bookmarks, deleted my e-mail accounts and basically tried to isolate any high usage items, but no joy.  What in the wide world of sports is taking up all of this space, and how can I get rid of it?  It seems excessive considering the actual content of my phone...

    DiskAid is a transfer tool for iPhone, iPad, and iPod.  It is available for both PC and Mac platforms.  It will allow you to see pretty much everything that is on your iPhone.  Once you have DiskAid installed go ahead and plug in your iPhone and make sure you back it up.  Now go ahead and open DiskAid.  On the far left you will see a bunch of different icons.  Click on File System, they may be a box that pops up that asks you if you know what you are doing.  Just click ok because we know what we are doing here.  Now click on Media, then iTunes_Control, then Music.  You will see a bunch of folders (like in the photo below), go ahead a delete them all.
    You will notice the size of “Other” has dropped dramatically!
    Read more at

  • External memory allocation and management using C / LabVIEW 8.20 poor scalability

    Hi,
    I have multiple C functions that I need to interface. I need
    to support numeric scalars, strings and booleans and 1-4 dimensional
    arrays of these. The programming problem I try to avoid is that I have
    multiple different functions in my DLLs that all take as an input or
    return all these datatypes. Now I can create a polymorphic interface
    for all these functions, but I end-up having about 100 interface VIs
    for each of my C function. This was still somehow acceptable in LabVIEW
    8.0 but in LabVIEW 8.2 all these polymorphic VIs in my LVOOP project
    gets read into memory at project open. So I have close to 1000 VIs read into memory when ever I open my project. It takes now about ten minutes to
    open the project and some 150 MB of memory is consumed instantly. I
    still need to expand my C interface library and LabVIEW doesn't simply
    scale up to meet the needs of my project anymore.
    I now
    reserve my LabVIEW datatypes using DSNewHandle and DSNewPtr functions.
    I then initialize the allocated memory blocks correctly and return the
    handles to LabVIEW. LabVIEW complier interprets Call Library Function
    Node terminals of my memory block as a specific data type.
    So
    what I thought was following. I don't want LabVIEW compiler to
    interpret the data type at compile time. What I want to do is to return
    a handle to the memory structure together with some metadata describing
    the data type. Then all of my many functions would return this kind of
    handle. Let's call this a data handle. Then I can later convert this
    handle into a real datatype either by typecasting it somehow or by
    passing it back to C code and expecting a certain type as a return.
    This way I can reduce the number of needed interface VIs close to 100
    which is still acceptable (i.e. LabVIEW 8.2 doesn't freeze).
    So
    I practically need a similar functionality as variant has. I cannot use
    variants, since I need to avoid making memory copies and when I convert
    to and from variant, my memory consumption increases to three fold. I
    handle arrays that consume almos all available memory and I cannot
    accept that memory is consumed ineffectively.
    The question is,
    can I use DSNewPtr and DSNewHandle functions to reserve a memory block
    but not to return a LabVIEW structure of that size. Does LabVIEW
    carbage collection automatically decide to dispose my block if I don't
    correctly return it from my C immediately but only later at next call
    to C code. Can I typecast a 1D U8 array to array of any dimensionality and any numeric data type without memory copy (i.e. does typecast work the way it works in C)?
    If I cannot find a solution with this LabVIEW 8.20 scalability issue, I have to really consider transferring our project from LabVIEW to some other development environent like C++ or some of the .NET languages.
    Regards,
    Tomi
    Tomi Maila

    I have to answer to myself since nobody else has yet answered me. I came up with one solution that relies on LabVIEW queues. Queues of different type are all referred the same way and can also be typecased from one type to another. This means that one can use single element queues as a kind of variant data type, which is quite safe. However, one copy of the data is made when you enqueue and dequeue the data.
    See the attached image for details.
    Tomi Maila
    Attachments:
    variant.PNG ‏9 KB

  • Short term memory allocator and Cache memor is out of memory

    Hi,
    I have three NW 6.5 sp8 servers in production. One of these, the one which holds Pervasive sql 9.7 began to show the following errors:
    Cache memory allocator out of available memory.
    Short term memory allocator is out of memory.
    360396 attempts to get more memory failed.
    request size in bytes 1048576 from Module SERVER.NLM
    I show here segstats.txt:
    *** Memory Pool Configuration for : DBASE_SERVER
    Time and date : 02:42:36 AM 12/02/2012
    Server version : NetWare 6.5 Support Pack 8
    Server uptime : 11d 04h 35m 28s
    SEG.NLM uptime : 0d 00h 01m 17s
    SEG.NLM version : v2.00.17
    Original Memory : 4,292,812,800 bytes (4.00 GB)
    ESM Memory : 805,302,272 bytes (768.0 MB)
    0xFFFFFFFF --------------------------------------------------------------
    | Kernel Reserved Space |
    | |
    | Size : 180,355,071 bytes (172.0 MB) |
    | |
    0xF5400000 --------------------------------------------------------------
    | User Address Space (L!=P) |
    | |
    | User Pool Size : 671,088,640 bytes (640.0 MB) |
    | High Water Mark : 559,710,208 bytes (533.8 MB) |
    | PM Pages In Use : 1,855,488 bytes (1.8 MB) |
    | |
    0xCD400000 --------------------------------------------------------------
    | Virtual Memory Address Space (L!=P) |
    | |
    | VM Address Space : 2,369,781,760 bytes (2.21 GB) |
    | Available : 801,435,648 bytes (764.3 MB) |
    | Total VM Pages : 800,870,400 bytes (763.8 MB) |
    | Free Clean VM : 785,563,648 bytes (749.2 MB) |
    | Free Cache VM : 15,306,752 bytes (14.6 MB) |
    | Total LP Pages : 0 bytes (0 KB) |
    | Free Clean LP : 0 bytes (0 KB) |
    | Free Cache LP : 0 bytes (0 KB) |
    | Free Dirty : 0 bytes (0 KB) |
    | NLM Memory In Use : 1,767,256,064 bytes (1.65 GB) |
    | NLM/VM Memory : 1,751,785,472 bytes (1.63 GB) |
    | Largest Segment : 2,097,152 bytes (2.0 MB) |
    | Lowest Kernel Page: 0 bytes (0 KB) |
    | : [0x00000000] |
    | High Water Mark : 2,243,096,576 bytes (2.09 GB) |
    | Alloc Failures : 370,804 |
    | |
    0x40000000 --------------------------------------------------------------
    | File System Address Space (L==P or L!=P) |
    | |
    | FS Address Space : 1,067,290,624 bytes (1017.8 MB) |
    | Available : 108,978,176 bytes (103.9 MB) |
    | Largest Segment : 3,362,816 bytes (3.2 MB) |
    | |
    | NSS Memory (85%) : 613,683,200 bytes (585.3 MB) |
    | NSS (avail cache) : 610,455,552 bytes (582.2 MB) |
    | |
    0x00627000 --------------------------------------------------------------
    | DOS / SERVER.NLM |
    | |
    | Size : 6,451,200 bytes (6.2 MB) |
    | |
    0x00000000 --------------------------------------------------------------
    Total NLMs loaded on the server: 307
    Top 20 Memory Consuming NLMs
    NLM Name Version Date Total NLM Memory
    ================================================== =============
    1. NWMKDE.NLM 9.70.07 Nov 14, 2008 813,035,623 bytes (775.4 MB)
    2. SERVER.NLM 5.70.08 Oct 3, 2008 467,216,096 bytes (445.6 MB)
    3. NSS.NLM 3.27.02 Nov 11, 2009 203,168,848 bytes (193.8 MB)
    4. NCPL.NLM 3.02 May 6, 2009 41,854,837 bytes (39.9 MB)
    5. NWSQLMGR.NLM 9.70.07 Nov 14, 2008 39,309,132 bytes (37.5 MB)
    6. DS.NLM 20217.07 Jan 30, 2009 24,851,303 bytes (23.7 MB)
    7. APACHE2.NLM 2.00.63 Apr 25, 2008 19,863,493 bytes (18.9 MB)
    8. CIOS.NLM 1.60 Feb 12, 2008 10,569,567 bytes (10.1 MB)
    9. OWCIMOMD.NLM 3.02 Nov 27, 2007 9,318,616 bytes (8.9 MB)
    10. APRLIB.NLM 0.09.17 Apr 25, 2008 8,959,760 bytes (8.5 MB)
    11. APACHE2.NLM 2.00.63 Apr 25, 2008 7,702,469 bytes (7.3 MB)
    12. FATFS.NLM 1.24 Aug 27, 2007 5,859,413 bytes (5.6 MB)
    13. NWPA.NLM 3.21.02 Oct 29, 2008 4,990,686 bytes (4.8 MB)
    14. PKI.NLM 3.32 Aug 25, 2008 4,069,957 bytes (3.9 MB)
    15. WS2_32.NLM 6.24.01 Feb 14, 2008 3,623,596 bytes (3.5 MB)
    16. NWMPM100.NLM 9.70.07 Nov 14, 2008 3,597,747 bytes (3.4 MB)
    17. NWODBCEI.NLM 9.70.07 Nov 14, 2008 3,459,159 bytes (3.3 MB)
    18. PORTAL.NLM 4.03 Sep 22, 2008 3,404,576 bytes (3.2 MB)
    19. JVM.NLM 1.43 Oct 16, 2008 2,701,919 bytes (2.6 MB)
    20. NLDAP.NLM 20218.11 Jan 30, 2009 2,579,131 bytes (2.5 MB)
    Top 20 NLM - Memory Trends
    NLM Name Original Memory Current Change
    ================================================== =========
    1. NWMKDE.NLM 842,068,071 bytes 813,035,623 bytes -27.7 MB
    2. SERVER.NLM 463,894,240 bytes 467,216,096 bytes 3.2 MB
    3. NSS.NLM 203,168,848 bytes 203,168,848 bytes 0 KB
    4. NCPL.NLM 41,850,741 bytes 41,854,837 bytes 4 KB
    5. NWSQLMGR.NLM 39,092,044 bytes 39,309,132 bytes 212 KB
    6. DS.NLM 24,896,359 bytes 24,851,303 bytes -44 KB
    7. APACHE2.NLM 19,855,301 bytes 19,863,493 bytes 8 KB
    8. CIOS.NLM 10,569,567 bytes 10,569,567 bytes 0 KB
    9. OWCIMOMD.NLM 9,277,656 bytes 9,318,616 bytes 40 KB
    10. APRLIB.NLM 8,959,760 bytes 8,959,760 bytes 0 KB
    11. APACHE2.NLM 7,702,469 bytes 7,702,469 bytes 0 KB
    12. FATFS.NLM 5,859,413 bytes 5,859,413 bytes 0 KB
    13. NWPA.NLM 4,957,918 bytes 4,990,686 bytes 32 KB
    14. PKI.NLM 4,135,493 bytes 4,069,957 bytes -64 KB
    15. WS2_32.NLM 3,619,500 bytes 3,623,596 bytes 4 KB
    16. NWMPM100.NLM 3,597,747 bytes 3,597,747 bytes 0 KB
    17. NWODBCEI.NLM 3,459,159 bytes 3,459,159 bytes 0 KB
    18. PORTAL.NLM 3,400,480 bytes 3,404,576 bytes 4 KB
    19. JVM.NLM 2,701,919 bytes 2,701,919 bytes 0 KB
    20. NLDAP.NLM 2,505,403 bytes 2,579,131 bytes 72 KB
    Logical Memory Summary Information
    ================================================== ===============================
    File System Cache Information
    FS Cache Free : 4,591,616 bytes (4.4 MB)
    FS Cache Fragmented : 104,386,560 bytes (99.6 MB)
    FS Cache Largest Segment : 3,362,816 bytes (3.2 MB)
    Logical System Cache Information
    LS Cache Free : 0 bytes (0 KB)
    LS Cache Fragmented : 722,448,384 bytes (689.0 MB)
    LS OS Reserved Data : 333,455,360 bytes (318.0 MB)
    LS Cache Largest Segment : 2,097,152 bytes (2.0 MB)
    LS Cache Largest Position : 2DE00000
    Summary Statistics
    Total Address Space : 4,294,967,296 bytes (4.00 GB)
    Total Free : 4,591,616 bytes (4.4 MB)
    Total Fragmented : 826,834,944 bytes (788.5 MB)
    Highest Physical Address : CFE53000
    User Space : 671,088,640 bytes (640.0 MB)
    User Space (High Water Mark) : 559,710,208 bytes (533.8 MB)
    NLM Memory (High Water Mark) : 2,243,096,576 bytes (2.09 GB)
    Kernel Address Space In Use : 2,572,759,040 bytes (2.40 GB)
    Available Kernel Address Space : 43,929,600 bytes (41.9 MB)
    Memory Summary Screen (.ms)
    ================================================== ===============================
    KNOWN MEMORY Bytes Pages Bytes Pages
    Server: 3487425552 851422 Video: 8192 2
    Dos: 86000 20 Other: 131072 32
    FS CACHE KERNEL NLM MEMORY
    Original: 3483172864 850384 Code: 46854144 11439
    Current: 108978176 26606 Data: 27242496 6651
    Dirty: 0 0 Sh Code: 49152 12
    Largest seg: 3362816 821 Sh Data: 20480 5
    Non-Movable: 81920 20 Help: 172032 42
    Other: 4235538432 4292855635 Message: 1236992 302
    Avail NSS: 610439168 149033 Alloc L!=P: 1661366272 405607
    Movable: 8192 2 Alloc L==P: 14843904 3624
    Total: 1751785472 427682
    VM SYSTEM
    Free clean VM: 785563648 191788
    Free clean LP: 0 0
    Free cache VM: 15306752 3737
    Free cache LP: 0 0
    Free dirty: 0 0
    In use: 1855488 453
    Total: 801435648 195663
    Memory Configuration (set parameters)
    ================================================== ==============================
    Auto Tune Server Memory = ON
    File Cache Maximum Size = 1073741825
    File Service Memory Optimization = 1
    Logical Space Compression = 1
    Garbage Collection Interval (ON) = 299.9 seconds
    VM Garbage Collector Period (ON) = 300.0 seconds
    server -u<number> = 671088640
    NSS Configuration File:
    C:\NWSERVER\NSSSTART.CFG
    File does not exist,
    or is zero byte in size.
    DS Configuration File:
    SYS:\_NETWARE\_NDSDB.INI
    File does not exist,
    or is zero byte in size.
    TSAFS Memory Information/Configuration
    ================================================== ==============================
    Cache Memory Threshold : 1%
    Read Buffer Size : 65536 bytes
    Max Data Sets for Read Ahead : 2
    Read Threads Per Job : 4
    NSS Memory Information/Configuration
    ================================================== ==============================
    Current NSS Memory Settings
    Cache Balance Percentage : 85%
    Cache Memory Allocated : 585.3 MB
    Available Cache from NSS : 582.2 MB
    Current NSS Caching Percentages
    Buffer cache hit percentage : 63%
    Name Tree cache hit percentage : 94%
    File cache hit percentage : 99%
    NSS Flush Status: Not Flushed
    Server High/Low Water Mark Values
    ================================================== ==============================
    NLM Memory High Water Mark = 2,243,096,576 bytes
    File System High Water Mark = 443,108 bytes
    User Space Information:
    User Space High Water Mark = 559,710,208 bytes
    Committed Pages High Water Mark = 87 pages
    Mapped VM Pages High Water Mark = 3,875 pages
    Reserved Pages High Water Mark = 400,103 pages
    Swapped Pages High Water Mark = 3,785 pages
    Available Low Water Mark = 294,670,336
    ESM Memory High Water Mark = 173 pages
    It seems that server.nlm is growing without limits. When tat occurs, I have the mentioned errors.
    Though NWMKDE seems to have grown. It remains steady around the showed values.
    I'm not brave enough to apply the memcalc's recommended fixes because the following line:
    set file cache maximum size=822083584
    returns an error saying the minimun value should be 1073741824.
    Can someone help me because I'm completely blind here.
    Thanks in advance.
    Gabriel

    I take it this is primarily a database server, in which case it's OK that Btrieve is using so much memory? You wouldn't want this to be a general file server too. Is the memory error causing any actual problem?
    Server is asking for only 1mb, and due to fragmentation there is little free memory (actually 2mb left, which is a little odd, but neither here nor there).
    Also, let's see your bti.cfg, which is the Btrieve config file. I'll paste in below an ArcServe TID on Btrieve using excessive memory:
    Symptoms
    Btrieve was upgraded to version 8.5 during the installation of ARCserve r11.1. The cachesize in the BTI.cfg microkernel section is at 20 MB (20480). (Pervasive would like this setting placed to 20% of the server memory or database size which ever is less.) The server will keep adding 20 additional Megs of memory to the total amount of memory the server is using for database transactions after each backup job. This can be verified by performing the following at the server console:
    LOAD MONITOR
    Scroll down to System Resources under Available Options and hit enter.
    Scroll down to Alloc Memory (Bytes) and hit enter.
    Locate NWMKDE.nlm in the Resource Tags list.
    Sort by memory bytes and you will slowly see nwmkde.nlm move to the top of the usage list. Unless the server is rebooted the small memory allocations stays at the increased amount.
    Explanation
    Starting with Btrieve version 8.5 and higher, Pervasive has been working to make the Btrieve database more dynamic. They have created a two-tier memory allocation approach. The first level is controlled by the cache size setting in the BTI.cfg. If this becomes inadequate, the second level will be accessed. The default setting for the second level is 60% of the server's total memory.
    The following line in the BTI.cfg will control the second level of memory caching:
    MaxCacheUsage=60; default is 60% of memory.
    An example would be a server with 100 MB of memory and the following settings in sys:\system\bti.cfg:
    [microkernel]
    cachesize=20480
    MaxCacheUsage=60
    This will cause the nwmkde.nlm to use 20 MB (20480) of memory initially and grow up to 60 percent of the total server memory or 60 MB.
    Now you also have to throw Max worker threads into the mix. A setting of Max worker threads = 3 in the BTI.cfg > Btrieve Communications Manager section will also use server memory. It will use 1 MB per thread. In this example, 3 Megs of additional memory will be used. That will bring the total amount of memory used by nwmkde.nlm to 20 MB (20480) + 3 MB = 23 MB when the server is first booted. After running some backups, this number could go up to as high as 60 MB (60% of server memory) if the server dynamically requires it.
    Resolution
    The MaxCacheUsage=60 setting must be set down from this 60% number. Pervasive recommends setting this from 0 to 20. The server needs to be rebooted for this change to take effect.

  • IPhone SDK - How to add application files and folders to Xcode?

    I want to package a folder with data specific to my app. The data is just a bunch of binary files in proprietary format.
    These files should be installed under /Documents folder of the application. The files themselves will be in a folder called say Data. So when i run the app from Xcode i want it to copy the files to
    /Documents/Data folder under the bundlePath.
    There could be a file called data.dat under the Data folder.
    So in my application i want to be able to use the NSFileHandle interface or the standard C fopen() function to access the file /Documents/Data/data.dat .
    How can i do this using Xcode? Is there a tool one needs to use to create an install package?
    Any help would be greatly appreciated.
    -TRS

    If you look at the SQLiteBooks example, it shows and example of installing some extra data (books.sql) into the documents folder. Look at the function createEditableCopyOfDatabaseIfNeeded in AppDelegate.m
    You should also add in the starting/static data files in the build process in XCode - you can probably add to, or create another build step that will copy the files from your host machine into the app bundle.

  • IPhone SDK: How to have application files not be backed up by iTunes?

    We are writing a set of files to the tmp directory on the device, with the expectation that iTunes will not back it up. However, we are seeing that those files are backed up on the host computer.
    The following documentation:
    http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhone OSProgrammingGuide/ApplicationEnvironment/chapter6_section3.html
    says:
    "tmp/ — The application writes any other temporary files here. The application is responsible for cleaning up all files created in this directory; there is no automatic cleanup mechanism. Backup operations ignore the contents of this directory."
    A sample value returned by NSTemporaryDirectory() is:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp
    For which we are saving our files in:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp/NSData /080702c
    However, when the device is disconnected and reconnected to the computer, and iTunes does a backup, we can see the files from tmp being transferred to a backup directory, eg.:
    ~/Library/Application Support/MobileSync/Backup/fb0a4b743a3c826d3146e0e34a9aa16e3c11eb0c
    Our questions are:
    1. Is the documentation correct about tmp not being backed up?
    2. Are we getting the path to tmp correctly?
    3. Is there something we can do or set to get tmp to not be backed up?
    4. Is there another directory we should be using for data files which need to persist between application launches but not be backed up?
    5. We have noticed that the path returned by NSTemporaryDirectory() is not the same as that formed by adding "tmp" to the path returned by NSHomeDirectory(); the former is /private/var/mobile/Applications/.../tmp while the latter is /var/mobile/Applications/.../tmp. Yet writing files to either seems to put them in the same place - are symbolic or other links being used to make these paths refer to the same directory? Which one should developers use?
    Thanks in advance for any suggestions and help.

    Partly to bump this but also to restate the question in less detail we a) want to save a number of text files for our app to use as a cache when it's relaunched, and b) don't want those files to be backed up by itunes when the iphone/touch is synced with the computer. How to do that?
    We thought the "tmp" directory within our application's sandbox would be the place for that, however, itunes is backing up the files we put there.
    Any ideas or suggestions much appreciated.
    Thanks.

  • Memory allocation and release

    Hi,
    i'm having some doubts on the memory issues, like allocation, release, EEPROM and RAM:
    Question 1:
    private method1()
    byte[]a = new byte[10];
    byte[]b = JCSystem.makeTransientByteArray(...);
    byte c;
    When will some memory be allocated to variables a, b and c, and when will that memory be released?
    Question 2:
    JCRE (until 2.2 at least) doesn't have Garbage collector, but if the card itself has that mechanism, will the applet automatically use it?
    Thanks in advance!

    It's not a question on how many EEPROM writes are done each day/hout/minute/second. It's a question of whether the data must be saved across sessions. RAM is mainly used for intermediate computations & session data. EEPROM is used to store persistent info (user info, credit, phonebook, etc...).
    RAM is also a good way to optimize processing time. If you have to manipulate a lot of persistent data during an APDU, it's a good idea to copy everything in a "cache" (transient buffer) and/or local variables, do all of your processing on the cached values, and then perform the persistent write at the end of the command.
    As to your last question on how much RAM is acceptable, it depends on the context. If you know that your applet will be alone, feel free to use as much as the platform can give you. If not, try to be reasonable. Cryptographic intensive applets generally use a lot of RAM to store intermediate computation results.
    From personal experience, I've written very simple applets that needed about 20 transient bytes, and complex ones that needed up to 1500 transient bytes. If you really need to set a limit, 200 bytes is already a considerable amount of transient space and should be more than enough for most applets. But then again, my guess is as good as any.

  • [iphone sdk]:  mailto format and/or image + compose email

    Devs,
    Has anyone had luck with \[ UIApplication openURL:@"mailto:" ] formats?
    I want to either have an http:// link in the body of the text or, even fancier, embed a picture similar to how the photo application animates and then inserts a lowres image inline
    i tried the following but w/ no success (it just pops up an alert about bad format):
    NSString *pixLink = @"http://apple.com/picture.jpg";
    NSString *str = \[NSString stringWithFormat:@"mailto:[email protected]&subject=Yo&body=%@", pixLink];
    NSString *encoded = \[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = \[\[NSURL alloc] initWithString:encoded];
    \[\[UIApplication sharedApplication] openURL:url];
    thanks!
    -s-

    thanks for the help! i misread the 'Mail Links' documentation and thought the '?' character was used to separate the to: and cc= that was in the example they gave.
    -thanks!

  • [iPhone SDK] Multiple Apps and App ID nightmare

    Maybe I don't understand this quite well or there's something wrong with Apple's Documentation.
    I've setup a single App ID using an asterisk for all my apps: "com.me.*" and the resulting App ID is something like: "##########.com.me.*"
    I've used this on two of my projects. When I try installing the two projects onto my iPhone, it uninstalls the previous app before installing the other! How can I have both Apps on my iPhone at the same time?
    The "Organizer" window conveniently uninstalls the first app and always only shows a single app in the list.
    What am I doing wrong?

    I would make sure that you did not set this app id in XCode. On the Developer Portal --> App IDs --> Manage tab it says:
    "You are not required to enter your App ID into your Xcode project. Xcode will incorporate the App ID automatically."
    I think you need a * at the end of your app id as well in the App ID configuration in the Developer Portal. You should have something like: 9AK2T6Z3YE.com.somecompanyorname.*
    I believe you would enter in "com.somecompanyorname.*" in the second input box when creating an app id.

  • IPhone SDK Memory Management

    Hi,
    I have following code:
    (void) DismissWelcomeMessage: (UIAlertView *) view
    [view dismissWithClickedButtonIndex:0 animated:YES];
    (void) ShowWelcomeMessage
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Blah" message:@"Blah Blah" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [self performSelector:@selector (DismissWelcomeMessage:) withObject: alert afterDelay: WELCOMEMESSAGEDELAY];
    [alert release];
    ShowWelcomeMessage is called first.
    Why DissmissWelcomeMessage works fine and does not crash even though alert object is released?
    Is it because Dismiss function uses copy of the object passed on stack as a parameter to function? But even then would not it be just a copy of the pointer pointed to the now deallocated object?
    Or [alert release] just decriment reference counting and does not really do the same as delete in C++?

    [[alert release]] just decrements the release count. dealloc is called on alert, like on any object, when its reference count raise 0.
    The message [self performSelector:@selector (DismissWelcomeMessage:) withObject: alert afterDelay: WELCOMEMESSAGEDELAY]; queues an event which retains both self and alert. The Event Manager will release both after sending the message (after the delay).
    The comments below traces the retain count of alert
    (void) ShowWelcomeMessage {
    UIAlertView *alert = [UIAlertView alloc] initWithTitle:@"Blah" message:@"Blah Blah" delegate:self
    cancelButtonTitle:@"OK" otherButtonTitles:nil; // retain count = 1
    alert show;
    self performSelector:@selector (DismissWelcomeMessage:) withObject: alert
    afterDelay: WELCOMEMESSAGEDELAY; // retain count = 2
    alert release; // retain count = 1
    An advice: don't use uppercase method name. Only Class names should be uppercased
    (void) DismissWelcomeMessage: (UIAlertView *) view // should be "dismissWelcomeMessage"
    (void) ShowWelcomeMessage // should be "showWelcomeMessage"

  • [iPhone SDK] Memory leak - NSPlaceholderString

    I'm having an issue with my app where using the Instruments tool I see that a NSPlaceholderString isn't releasing 16bytes of data.
    The 'Responsible Caller' text reads:
    -[NSPlaceholderString initWithFormat:locale:arguments:]
    All my getters use:
    return [[[[NSString alloc] initWithFormat:@"%@someformating",someObject] retain] autorelease];
    Does anyone have any clues as to what I should be looking out for?

    The history actually relates to an accessor method. I seemed to have misunderstood the documentation ("Accessor Methods"), the retain shouldn't be there.
    I'll give it ago without retain and see what happens.

  • IPhone SDK: change certificate and/or provisionning of existing app

    Hi,
    We recently moved from individual to corporation and I was wondering if we can revoke our dist certificate to create a new one, and at the same time, create new provisionning profiles for our apps?
    I'm not sure but for updating apps, don't the provisionning profile needs to remain the same?
    Thanks!

    I would make sure that you did not set this app id in XCode. On the Developer Portal --> App IDs --> Manage tab it says:
    "You are not required to enter your App ID into your Xcode project. Xcode will incorporate the App ID automatically."
    I think you need a * at the end of your app id as well in the App ID configuration in the Developer Portal. You should have something like: 9AK2T6Z3YE.com.somecompanyorname.*
    I believe you would enter in "com.somecompanyorname.*" in the second input box when creating an app id.

  • IPhone SDK - post bugs and problems with the Firmware...

    So far I'm noticing issues with the 2.0(5A225c) build of the OS.
    Everything is much slower than it used to be for one. I have a simple UIViewController with a table with only 9 text elements. It doesn't even fill the screen and it scrolls like a snail. My app runs so slow, but I can't tell if it's a performance issue in my app, or a debug firmware. Even the slider to unlock is slow and so is scrolling in all OS menus.
    I also noticed in Contacts that the fast slider on the right appears but does not respond to touches. So much for actually using my phone for the next few months. I hope they fix some of this stuff soon.
    Anyone else noticing issues?

    What a relief! I can also confirm that this build is very slow. I am writing a game called Trism (www.demiforce.com for info) which makes use of layered UIImageViews for the game pieces, scoring, borders, and so on. When beta 2 arrived, I got really disheartened because suddenly everything was moving much more slowly. I initially thought the slowdown was because of some fault in my code, which led me to learn some lower-level CoreAnimation and Quartz stuff, which has got the speed back around where it was originally.
    We can only hope the slowdown is due to new features of the OS needing to be tightened up a bit, and not as a sign of things to come. Nevertheless, I encourage other developers out there to take a look at using different implementations if need be. Specifically, if your views or text labels don't require the heavy animatable features of the UIView class, try taking a look at using the lower-level CALayer class and see if that helps your performance.

  • IPhone SDK 2.2 memory corruption

    Hello. I'm working on an application for iPhone SDK 2.2 and seem to be having weird memory corruption problems. Not necessarily leaks because using Instruments shows my memory stamp never going above about 1.8 megs. The nature of the app is a database of animals so I'm constantly loading and unloading sounds and images. None of the objects are very large (at most I'll have 4 800k pngs loaded at once) and I've checked and rechecked my alloc/retain/release and everything is in order (hence no memory usage increase). However...after using the application for a while I'll notice strange behavior. For example:
    1) we have a UILabel as the title for each page. After a while the font size of this will change.
    2) I have several screens with a subclassed UIScrollView where images are loaded and then added to. The problem shows itself here by the images not showing up. there's no crash, stepping through the debugger shows that the image loads up fine, it's just that the image is not there.
    3) I have a UILabel at the top of an animal description screen, which in the nib file is called "Animal Name" by default. This will change to show "Animal Name" at the top.
    I've removed all audio in our latest build so that isn't the problem. What I'm starting to suspect is that altering anything defined in a nib file will cause corruption. For example, the UIScrollView is defined in the nib file, and I constantly am reassigning the contents of that with a UIImageView. This UIImageView is handled within the subview class like :
    UIImageView *imgView = [[UIImageView alloc] initWithImage: [ UIImage imageWithContentsOfFile:[[NSBundle mainBundle ] pathForResource:imageToLoad ofType:@"png" ]] ];
    imgView.tag = 50;
    [self addSubview:imgView ];
    [ imgView release ];
    Then later when moving away from the screen I'll find that view's tag and remove it from the superview (since addSubView increases the retain count, the alloc+addSubView is cancelled by release+removeFromSuperView)
    I can't explain why titles that are never changed would be affected, but it must somehow be related. What I'm wondering is: are there any known issues involving modification of the contents of objects defined in Nib files? Perhaps the memory allocated when initWithNibName is restrained, then any modification of objects allocated within it can cause corruption. I'm starting to think I should just alloc and free anything modified in code and skip using nib files altogether (I reset the text on buttons for example). If this is a known issue please let me know. I'll give you more information if I can.
    Thank you

    Just download the huge SDK package and install. No need to uninstall the old SDK.

  • How to check actual allocated and used memory for java process in solaris?

    Hi,
    I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
    I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
    So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
    Thank you.

    With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
    With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
    Nick.

Maybe you are looking for

  • How do I get my contacts from my Mac to the iCloud after the first set up?

    I have all my contacts on my MacBook but only some of them went into the iCloud. How do I "re-do" the initial launch and get all the contacts in the icould to now sync with my 4s and iPad2?

  • Logical Standby & Primary site Time Diiference

    Hi, I have the one primary site over RAC configuration and one Logical standby Site.We have configured the Logical standby for archived files. We would like to know, how can we compute the time difference between Primary Site and Logical Site ex. IF

  • How to tranfert a DVD to my itunes

    I just buy a macbook pro and i'd like to know how to transfert my DVD's on my macbookpro to have movie i like on iTunes. Thanx for your answers ! :-)

  • IPQoS panic: BAD TRAP in module "flowacct" due to NULL pointer.

    I've recently started using IPQoS and the flowacct module to do some very simple tracking of bandwidth usage (along with one tokenmt action to meter traffic to and from one particular zone) on a host with multiple zones, running Solaris 10 x86, 11884

  • Adobe CQ integration with Liferay

    Hi I am trying to integrate adobe CQ 5.5 with Liferay using CMIS. I followed this link http://dev.day.com/docs/en/crx/current/deploying/cmis.html to enable CMIS in Adobe CQ but i got this error: No resource found Cannot serve request to /cmis/reposit