[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GSSet explodes with too many data
From: |
andre levy |
Subject: |
GSSet explodes with too many data |
Date: |
Tue, 07 Sep 2004 12:51:04 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
my company develops a software to explore very large quantities of data
using GNUstep-base 1.9.2 mainly on windows.
it works generally well in production with our customers. (our customers
are bankers!...)
In development, it allows us to do the coding on mac OSX then build on
windows and then check for diffences. we're also very happy with this.
however we did find some bugs for which we wrote some workaround.
when we feed the product with too many data it explodes with a
windows-like core-dump.
our debugging showed that we relied on GSSet: - (NSArray*) allObjects
which explodes because the objects array is allocated on the stack,
which has a limited size, rather than on the heap.
therefore, we rewrote the method as:
- (NSArray*) allObjects
{
id *objs;
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
unsigned i = 0;
id o;
objs = (id *)NSZoneMalloc([self zone], map.nodeCount * sizeof(id));
while (node != 0)
{
objs[i++] = node->key.obj;
node = GSIMapEnumeratorNextNode(&enumerator);
}
GSIMapEndEnumerator(&enumerator);
o = AUTORELEASE([[arrayClass allocWithZone: NSDefaultMallocZone()]
initWithObjects: objs count: i]);
NSZoneFree([self zone], objs);
return o;
}
I figure this is not the best way to go. if there is anything I can do
to help, let me know. I'll be happy to help.
--andre
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- GSSet explodes with too many data,
andre levy <=