• 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
vm keeps increasing when in a rigorous loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vm keeps increasing when in a rigorous loop


  • Subject: vm keeps increasing when in a rigorous loop
  • From: Nick Rogers <email@hidden>
  • Date: Sun, 08 Jul 2012 23:36:12 +0530

Hi,

The code is like:

- (void)myMethod
{
	.........

	while (flag) {
		UInt32 temp;
		..... and lot of other ints etc.
		if (someCondition == 1) {
			UInt8 *buff = (UInt8*)calloc(1, sizeof(aStruct));
			if (someOtherCondition == 1) {
				[self addPointerToATree:buff];
			}
			else
				free(buff);
		}
	}
}

The while loop runs very rigorously without having much delay in it.
Memory for buff is only needed when certain condition is met.
I have seen that even when this condition is not met and no memory is allocated, the VM keeps growing steadily as seen in Activity Monitor.
So the only thing contributing to it would be the various ints etc.
But the app is GC enabled (required), so the VM size should reset to some level every few seconds, but doesn't.
The loop does many thousands of iterations per second.

Any idea on how to limit this usage?
Shall  help.
I have a auto release pool drained at the end of every iteration in a loop in some other method but that doesn't seem to have much effect.

Wishes,
Nick



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: vm keeps increasing when in a rigorous loop
      • From: Jens Alfke <email@hidden>
    • Re: vm keeps increasing when in a rigorous loop
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Document Based Application
  • Next by Date: identifying if an application is not responding
  • Previous by thread: Re: turning app into background app
  • Next by thread: Re: vm keeps increasing when in a rigorous loop
  • Index(es):
    • Date
    • Thread