• 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: Malloc()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Malloc()


  • Subject: Re: Malloc()
  • From: Jim Correia <email@hidden>
  • Date: Tue, 2 Apr 2002 13:45:49 -0500

On Tuesday, April 2, 2002, at 12:31 PM, Vince DeMarco wrote:

On Monday, April 1, 2002, at 10:49 PM, Jason Moore wrote:

here is where the problem is. the log output is 'buffer size is: 4', even when i change the malloc
statement to read buffer = malloc(129) (129 is the size of the buffer i need in my test case).

any ideas?


Try using malloc_size(buffer)

sizeof(buffer) will return the size of the buffer variable instead.

Only do that if you want to know how much space you can use, not how much space you asked form.

char *buffer = malloc(129);

malloc_size(buffer) will be >= 129

Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Malloc() (From: Vince DeMarco <email@hidden>)

  • Prev by Date: Re: Malloc()
  • Next by Date: Premature _NSAutoreleaseNoPool() warnings
  • Previous by thread: Re: Malloc()
  • Next by thread: Re: Malloc()
  • Index(es):
    • Date
    • Thread