473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Boost serialization : Stream error exception

{ not sure you're aware of that but there are the newsgroups for all
major operating systems. you might want to try asking in the forum
'comp.os.linux.development.apps', since memory-mapped files are not
a language-supported structure, they are platform-specific. -mod }

I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception. Any
ideas what could trigger this? A search of the Boost archives indicated
other people had the same problem, where the solution was "use binary
mode when you open the file"... but I'm not using a file on disk, I'm
using a mmap'd file.

The OS i'm using is Linux.
Thanks for any suggestions...
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #1
2 6588

sm*******@excite.com wrote:
[...]
I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception. Any
ideas what could trigger this? A search of the Boost archives indicated
other people had the same problem, where the solution was "use binary
mode when you open the file"... but I'm not using a file on disk, I'm
using a mmap'd file.
In my opinion you stand better chances of receiving help if you post to
the Boost User mailing list:
http://www.boost.org/more/mailing_lists.htm#users

Cheers,
Nicola Musatti
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #2
sm*******@excite.com wrote:
{ not sure you're aware of that but there are the newsgroups for all
major operating systems. you might want to try asking in the forum
'comp.os.linux.development.apps', since memory-mapped files are not
a language-supported structure, they are platform-specific. -mod }
I'm trying to use boost serialization to serialize/deserialize data to
and from a mmap'd file. I have my own ostream/istream classes that
essentially read/write bytes from a mmap'd file. The process works fine
except on some rare occasions (With different objects/number of
objects), in which case boost throws a "stream error" exception.
On reading, or on writing? And what does "stream error" mean: I
would expect that it refers to an error returned by the
iostream, but it would be best to be sure---it could also refer
to an error in the format of the input stream (unexpected EOF,
etc.).
Any ideas what could trigger this? A search of the Boost
archives indicated other people had the same problem, where
the solution was "use binary mode when you open the file"...
but I'm not using a file on disk, I'm using a mmap'd file.
The image must be binary, i.e. when you read, you must be
guaranteed to see exactly the same bytes as when you wrote.

Writing to a mmap'd file can be tricky. Basically, mmap (at
least under Unix) presents a view of a fixed length file; if a
write would extend the file, you have to take special actions.
If you don't, it's entirely possible that when you reread the
file, you loose a bit at the end. (It's also possible, of
course, that you core dump on writing.)

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: eyal.susser | last post by:
Hi, I'm using the Boost serialization library. Iwant to serialize classes into simple buffers on RAM. There doesn't seem to be a suitable archiver. Am I missing it? The ones I saw were for...
4
by: ron | last post by:
Hi, I have class object that i serialize using the System.Xml.Serialization class. Intermittently the object is not getting serialized correctly, using System.Xml.Serialization classes....
1
by: Sacha | last post by:
I'm having trouble serializing some of my classes when using late binding. When I don't use late binding, it works fine. MyClass inherit from an abstract class called AbsMyClass. If I do the...
4
by: Aaron Clamage | last post by:
Hi, Could someone please confirm the following? I think I have found a subtle .NET serialization bug. It occurs when object has a list of items containing another object of the same type and...
3
by: Steve | last post by:
I've been following a couple remoting tutorials on the web, they are all pretty much the same. I've got my different applications built(client, server and remote object (dll)) The client is...
2
by: Maximus | last post by:
Hi Everyone, I was using Inprocess session objects, but incase of aspnet process crashes the session objects were lost as a result I decided to shift to out of porocess session objects. For this...
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
0
by: Abhishek Padmanabh | last post by:
I have been trying out boost's serialization library for the past few days. And I have come across a problem serializing a class that has a reference member. The code is posted as below: ...
8
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(<stream>,<Obj>) method. The type of <streamis...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.