Hello,
We use a custom memory allocator to allocate Objective C objects,
and it doesn't play well with libobjc2 small objects concept.
Here's how our code looks:
@implementation Request
+ (Request *) alloc
{
size_t sz = class_getInstanceSize(self);
id new = palloc(fiber->gc_pool, sz);
object_setClass(new, self);
return new;
}
Unfortunately, classForObject doesn't play along with an object
allocated this way, which leads to a crash in msg_send.
I figured (from the source) that object address got to be word-aligned to
ensure the runtime doesn't treat it as small object.
Is this correct? What are the chances of it breaking in the future?
What's the approach to memory allocation which ensures
custom-allocated objects are not mixed up with small objects?
Thanks,
--
http://tarantool.org - an efficient, extensible in-memory data store
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep