Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloc



On 7/9/08 5:55 PM, andrea lucaroni said:

>I writing a code in C, i run my code with powerpc-apple-darwin8-g++-4.0.1,
>my code compiles, to its inside demands an Array of 100000 elements (has
>controlled if I malloc the memory well) i get:
>
>a.out(1232) malloc: *** vm_allocate(size=172032) failed (error code=3)
>a.out(1232) malloc: *** error: can't allocate region
>a.out(1232) malloc: *** set a breakpoint in szone_error to debug
>
>-----
>//code
>int dimdatif=100000;
> chunk=(int *)malloc(dimdatif*sizeof(int));
>
>....
>
>delete chunk;
>--------

Don't use delete with memory allocated by malloc(), use free().

Also, enable all the memory testing environment variables and try again:
<http://developer.apple.com/technotes/tn2004/tn2124.html#SECMALLOC>

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >malloc (From: "andrea lucaroni" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.