On Mon, Nov 30, 2015 at 8:41 AM, Dimitris Chloupis <kilon.al...@gmail.com>
wrote:

> I have a class A that has an instance variable the references an instance
> of Class B , but also Class B has an instance variable the references an
> instance of Class A. Basically its a GUI that references its model and the
> same model referencing the same instance of GUI.
>
>
Dimitris,

Fuel solves the circular references in the traditional way, that is, while
traversing the graph, after processing each objects it stores it in a
IdentityDictionary. Then, for each object to be processed, it first checks
if the dictionary already includes that object. If true, then it has
already been processed. If not, then lets process/traverse.



> How Fuel deals with such scenario because I saw that it created an output
> of 1.5 mbs for several instances of my model class ? Is there any danger of
> having such circular references or it does not matter because afterall they
> are just pointers ?
>

As Sven said, you need to be careful because you cannot be sure exactly all
what Fuel can reach from a certain graph. If the graph was serialized into
a 1.5mb then it has nothing to do to the fact of having circular
references. It's simply the fact of the graph that ended up traversed.

There are some tools inside Fuel to know what has been
"traversed/processed" and that will next be serialized. This may help you
realize that you are including in the graph things you don't want. We have
http://rmod.inria.fr/web/software/Fuel/Version1.9/Documentation/Debugging
but I am not sure if that's a bit outdated. Give it a try and if not ask.
The ideally is to at least get the list of classes and instances that are
being serialized. That's quite a help in a first place.

Finally, if you found parts of the graph that you didn't want to serialize,
then you can use different Fuel hooks to solve that (substitutions,
ignoring certain intsVars, etc etc).

Best,



-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to