sayoyo Sayoyo
2008-May-21 17:52 UTC
custom serialization problem (marshal_dump, marshal_load)
Hi, I have a problem with the marshal_dump and marshal_load... I built two classes XXX, YYY and implemented both methods like this: class YYY @data = "string" @version = 1 def marshal_dump() return [@version,@data] end def marshal_load(var) @version = var[0] case @version when 1 @data = var[1] else #do something else end end end class XXX @data = Array of YYY @version = 1 def marshal_dump() return [@version,@data] end def marshal_load(var) @version = var[0] case @version when 1 @data = var[1] else #do something else end end end The serialization works correctly when the number of objects YYY is small, but when it got more than 5000, the serialization doesn''t work. (the serializaed file has more and less 1 meg) When I try to not to use marshal_dump and marshal_load. the serialization works again???? Can someone tell me, where is the difference between customized serialization and no-customized one??? Thanks you very much Sayoyo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-21 20:17 UTC
Re: custom serialization problem (marshal_dump, marshal_load)
On 21 May 2008, at 18:52, sayoyo Sayoyo wrote:> > The serialization works correctly when the number of objects YYY is > small, but when it got more than 5000, the serialization doesn''t work. > (the serializaed file has more and less 1 meg) >Asking smart questions, lesson 1. Never say "it doesn''t work". Do say exactly what happens and how that differs from what you expected. Fred> > When I try to not to use marshal_dump and marshal_load. the > serialization works again???? > > Can someone tell me, where is the difference between customized > serialization and no-customized one??? > > Thanks you very much > > Sayoyo > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- use of Marshal with wxruby classes
- no marshal_dump is defined for class Proc
- ":database_manager =>CGI::Session::MemoryStore" doesn''t work properly...???
- [RESOLVED] Marshal.dump not dumping entire object?
- storing object with no "marshal_dump is defined" in session