Large stack size in Mac application - macos

I have a cocoa application running on Mac OS 10.8.2. After running for 10 hrs, its memory usage increases considerably. I checked using Instruments tool, but no memory leaks are observed. When I analyze the VM allocations, it shows me that 50% of the memory is consumed by stack pages. It contains around 10K stack pages, which is weird. I have around 17 threads, but they are not created or destroyed during the execution. They are just setup initially.
I am sure that this increased stack size is problem, but I am clueless on how to analyze it further. Instruments tool does not give an idea of who allocated those stack pages.
Please help me. Any hints are much appreciated.

Related

How does memory usage in Windows affect performance

I'm running windows 10 with 4GBs of DDR3 1066 on Intel second generation i5 mobile architecture.
I come from a OSX background mostly and memory has always been a concern for me because I prefer to have many tabs open. I noticed on OSX that the memory usage didn't relate that much to the performance of the applications so long as it wasn't fully saturated but easily on my iMac I can run 80% of memory and find no noticeable lag or stuttering. However on Windows I'm finding memory to be the major bottleneck in my system, I understand that upgrading to 8 or 16GBs of memory would be the upgrade path for me. However I would love to understand why my system slows down noticeably when I saturate 80% of the memory unlike OSX that seems to handle it just fine. Is it a bandwidth limitation? I know that Windows NT and Darwin are completely different Kernels and I would love to be educated in exactly how that affects the same usage scenario so differently.
Thank you in advance.

Unable to Understand Instrument data

Hi I am profiling my application with Instruments in order to
Find how much memory my Application is using.
I am downloading a file of around 100MB . and I am getting some strange data in instruments which i am unable to understand.
Can anyone help me understand the data shown by Instruments. (refer to Screenshot)
and How much memory my application is using in real ? (I am using iOS 7).
Focus on the Live Bytes column for All Heap Allocations to see how much memory your application is using. You cannot control your application's Anonymous VM size.
In your screenshot the Live Bytes column for All Heap Allocations is 3.36 MB, which is good. The Live Bytes column measures the amount of memory your application is currently using, but it does not include any allocated memory for OpenGL ES textures. You should also profile your application with the Memory Monitor instrument to determine how much memory your application is using.
To use the Memory Monitor instrument, click the Library button in the toolbar to get a list of available instruments. Drag the Memory Monitor instrument to the instrument list on the left side of the trace document window (Allocations and VM Tracker in your screenshot). Alternatively, you can choose the Activity Monitor template, click the Info button for the Activity Monitor instrument, and click the Configure button to tell the Activity Monitor instrument to list the physical memory used.

mac osx occupied memory increase quickly

I noticed when I run Xcode especially start to run Interface builder.
Mac osx occupied memory increased quickly.
Not only xcode, there are some other apps also cause memory occupy too much after running a while.
Even the memory of my mac is 4GB, some time I have to use tool to free memory.
What is reason and how to avoid this case happen in my developing mac app?
Welcome any comment
I just experienced something similar(but probably not the same) in my Qt application.
I was reading and checksumming lots of files and the free memory kept dropping, though my appliations "real memory" stayed at a steady 50ish MB. However the amount of "Inactive memory" kept climbing.
What was happening was that every file i read was being added to the disk cache. The memory consumed by the disk cache is apperantly marked as "inactive", which should be just as availible as "free" memory according to apple ( http://support.apple.com/kb/HT1342 ) but that didn't stop OSX from starting to swap when "free" hit below 50ish MB.
in C:
#include "fnctl.h"
fcntl(f.handle(),F_GLOBAL_NOCACHE,1);
Seemd to fix that by bypassing disk caching for that file descriptor.
Freeing up inactive memory ( if that is indeed your problem ) can also be done from the commandline using the "purge" command.

Memory issue on normal Cocoa Apps? (for example preview.app)

I opened preview.app and started scrolling up and down between 2/3 pages continuosly for 5 minutes. I noticed that memory increased of 4 or 5 MB. Potentially I could continue forever for obtaining a memory overflow.
Why scrolling up and down memory increases? (I started with 29 MB of Real Mem). Can we trust activity monitor?
Cocoa and/or Preview are probably cacheing the image(s) you are scrolling through, which is normal (and designed not to take up all your RAM).
Don't be surprised if your own app does this, but be sure your code is not leaking.

Increase memory for shared memory

When trying to get shared memory, shmget() often fails because being unable to allocate memory. The physical size of RAM really shouldn't be the problem (4GB is enough, I think).
Rather there's probably anywhere in the systems properties a limit for allocating shared memory set. Does anyone know, where I can find this property?
I'm using Mac OS X Version 10.6
Depends on the OS. PostgreSQL documentation has tips for changing the shared memory limit on various platforms.

Resources