On Mon, Jul 20, 2009 at 12:56, Erik Corry<[email protected]> wrote: > 2009/7/20 v8hope <[email protected]> >> >> It seems like if a v8::String is called "MakeExternal()", deserialize >> will crash. >> serialize.cc does not handle this case. >> Correct me if I am wrong. > > I think you are right.
The problem is that an external string refers to characters allocated by the embedding program. When serializing the external pointer is not preserved as V8 has no way of recreating the memory layout of the embedding program. The correct way to solve this is either to fail serialization of external strings, have some smarter callback mechanism when serializing and deserializing external strings or to make these external strings internal again as part of serialization. The last option will of course change the behavior of your strings potentially if the embedding program relies on certain strings being externalized. I am leaning towards the first option here to avoid the hard to diagnose crasher when loading the snapshot. Cheers, -Ivan P.S. Patches are welcome... > -- > Erik Corry, Software Engineer > Google Denmark ApS. CVR nr. 28 86 69 84 > c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018 Copenhagen K, > Denmark. > > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
