• 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: Memory "weight" of objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory "weight" of objects


  • Subject: Re: Memory "weight" of objects
  • From: Daniel Jalkut <email@hidden>
  • Date: Sun, 04 Dec 2005 17:03:46 -0500

I suppose I should add a disclaimer that the numbers returned by malloc_size might be larger than actually used by the object. It's probably always rounded up to whatever malloc's block sizes are. I don't know if NSObject instances are small enough to share a single 16 byte memory block, though.

Daniel

On Dec 4, 2005, at 4:54 PM, Daniel Jalkut wrote:

Hi Felix. You can answer this for any object you're curious about using the "malloc_size" function. You can even do it from the GDB command line:

(gdb) call (long)malloc_size((void*)[NSObject alloc])
$10 = 16
(gdb) call (long)malloc_size(@"1")
$11 = 16
(gdb) call (long)malloc_size((void*)[NSData dataWithBytes:"1" length:1])
$12 = 32

Of course, the data itself is stored separate from the object, but I assume you're looking for baseline values since you specified "1 char" values.

Daniel

On Dec 4, 2005, at 4:45 PM, Felix Schwarz wrote:

Hi,

I'm wondering, how much memory does an instance of a

NSObject (to know about the common "base weight" of an object)

NSString (1 character)

NSData (1 byte)
..

approximately occupy?

Felix
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com

This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Memory "weight" of objects
      • From: John Stiles <email@hidden>
References: 
 >Memory "weight" of objects (From: Felix Schwarz <email@hidden>)
 >Re: Memory "weight" of objects (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: Memory "weight" of objects
  • Next by Date: Re: Bindings / CoreData / two windows issue
  • Previous by thread: Re: Memory "weight" of objects
  • Next by thread: Re: Memory "weight" of objects
  • Index(es):
    • Date
    • Thread