Re: appendBytes memcpy
Re: appendBytes memcpy
- Subject: Re: appendBytes memcpy
- From: Filipe Varela <email@hidden>
- Date: Wed, 1 Aug 2007 10:28:30 +0100
On 2007/08/01, at 08:44, roger casaliƱas wrote:
I'm not sure if it's the memory capacity because the PPC has 512MB
but it
never crashes there. The Intel has 1GB RAM yet it still crashes.
Does the
PPC and the Intel have different memory addressing capacities?
They do, for sure. But the differences depend on what sub-
architecture you have on those machines.
Is the PPC a G4 (32 bit) or G5 (64 bit)? Is the Intel a Core (32 bit)
or a Core 2 (64 bit)?
You can simulate a memory exaust by writing a simple program that
allocs a chunk of memory roughly the same size as the total length of
the NSMutableData would hold.
Try this
int main(int argc, char *argv[])
{
uint8_t *dataPtr;
dataPtr = malloc(total_len_here);
if (dataPtr == NULL)
perror("malloc() errored");
free(dataPtr);
return 0;
}
This should be lots of fun to watch with Activity Monitor :) Try sleep
()'ing for some seconds before the free call.
Another possible cause for the issue is that because you are
appending data to an existing instance, the runtime is not just
calling malloc. It's calling realloc (or programatically - runtime
does this? - calling malloc, memcpy, free old pointer), so there must
be a chunk (issues with mem paging large chunks?) with enough length
to hold the new data. But the old data must be copied to the new one
before it's freed so your app consumes at least
total_len_before_append + total_len_after_append during the append
operation.
A couple of months ago i wrote a simple tool to fetch google map
tiles based on coordinates, tile span and zoom level provided by the
user. It's a basic tile composition app. On some very large images
(ie, 80 x 80 tiles) i get memory errors on my G5 (1.5GB RAM) but not
on my MacBook (first gen 32bit, 1GB RAM). Maybe your issues are
related to mine?
Cheers,
Filipe_______________________________________________
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