Global max number of methods?

View: New views
1 Messages — Rating Filter:   Alert me  

Global max number of methods?

by dennisf486 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Because it was simpler to do, I made my C++ binding code use 1 proto for all my objects, and when I create a new bound C++ object I reuse the proto but register a bunch of methods on it.  Every time a new C++ object is wrapped and bound to Io, a complete new method table is created for it and applied to the Io object that represents it.

Now I find that when I have Io code that uses my binding objects in a loop (so that it generates a lot of bound C++ objects) I quickly run into a memory seg fault occuring in Io's hash table code.  It's doing weird things like trying to access a hash table element at memory address 0x00000070.  Am I registering too many methods and overflowing some global method registry?

Would it be better to register separate protos for each C++ class and set of C++ methods and just clone those protos?  But if I have a target object in the data pointer of an Io object, and the method lookup reaches a method on the proto, is it going to call my C-function with self being the actual object (and thus the data pointer being the actual object) or is it going to call the C-function with self and data pointer being just the proto?