[serialization] Out of memory with Borland C++ Builder 60
Hi everyone. Im having problems compiling some code
with Borland C++ Builder 6 that includes libboost
serialization. In particular Im having troubles
registrating a new class in order to be serialized.
The new class, say A3, is a subclass of antother that
is declared abstract, say A. A has already some
subclases (A1, A2) that are serialized correctly.
As I did for other subclasses on the same hierarchy, I
added the instruction
ar.register_type(static_cast
Federico Feller wrote:
After doing that, I tried to compile the code and got the following error from the compiler:
[C++ Fatal Error] if.hpp(72): F1008 Out of memory
I have lots of problems using serialization under BCB6. Only with our large data structures of many nested classes. A lot of our issues have to do with inline expansions in release builds so disabling these helps, but I have still got to the stage where we get problems even in debug builds. We get internal compiler errors. My guess is that the amount of template code generated is just too much for the compiler, as simple, small, classes serialize fine, but bigger ones can be pushed over the edge by adding one more member to the list. My best guess for us at a solution is to stop functions being template based. I.e. if you know your class gets serialized to binary archives only, create non-template functions that don't have to have implementations in the header, and split them accross translation units such as void serialize_part1(binary_oarchive& boa); void serialize_part2(binary_oarchive& boa); I haven't tried this yet, but it is the only way I can think of to reduce the load on the compiler. The serialization library does stress the compiler quite badly because of the amount of inline-able and template based code. Cheers Russell
Russell, thanks for your answer. I've tried removing
the template specifications, but it didn't solve the
problem. Unfortunally I had to stop using the
serialization library and try something else.
Cheers
Federico
--- Russell Hind
Federico Feller wrote:
After doing that, I tried to compile the code and
got
the following error from the compiler:
[C++ Fatal Error] if.hpp(72): F1008 Out of memory
I have lots of problems using serialization under BCB6. Only with our large data structures of many nested classes. A lot of our issues have to do with inline expansions in release builds so disabling these helps, but I have still got to the stage where we get problems even in debug builds.
We get internal compiler errors. My guess is that the amount of template code generated is just too much for the compiler, as simple, small, classes serialize fine, but bigger ones can be pushed over the edge by adding one more member to the list.
My best guess for us at a solution is to stop functions being template based. I.e. if you know your class gets serialized to binary archives only, create non-template functions that don't have to have implementations in the header, and split them accross translation units such as
void serialize_part1(binary_oarchive& boa); void serialize_part2(binary_oarchive& boa);
I haven't tried this yet, but it is the only way I can think of to reduce the load on the compiler. The serialization library does stress the compiler quite badly because of the amount of inline-able and template based code.
Cheers
Russell
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
One thing that might or might help is using the approach illustrated in the example demo_pimpl. The permits serialization for each combination of data type and archive type to be compiled separately. This might keep things small enough to avoid the compiler's problems. Robert Ramey Federico Feller wrote:
Russell, thanks for your answer. I've tried removing the template specifications, but it didn't solve the problem. Unfortunally I had to stop using the serialization library and try something else.
Cheers
Federico
--- Russell Hind
wrote: Federico Feller wrote:
After doing that, I tried to compile the code and
got
the following error from the compiler:
[C++ Fatal Error] if.hpp(72): F1008 Out of memory
I have lots of problems using serialization under BCB6. Only with our large data structures of many nested classes. A lot of our issues have to do with inline expansions in release builds so disabling these helps, but I have still got to the stage where we get problems even in debug builds.
We get internal compiler errors. My guess is that the amount of template code generated is just too much for the compiler, as simple, small, classes serialize fine, but bigger ones can be pushed over the edge by adding one more member to the list.
My best guess for us at a solution is to stop functions being template based. I.e. if you know your class gets serialized to binary archives only, create non-template functions that don't have to have implementations in the header, and split them accross translation units such as
void serialize_part1(binary_oarchive& boa); void serialize_part2(binary_oarchive& boa);
I haven't tried this yet, but it is the only way I can think of to reduce the load on the compiler. The serialization library does stress the compiler quite badly because of the amount of inline-able and template based code.
Cheers
Russell
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Federico Feller wrote:
Russell, thanks for your answer. I've tried removing the template specifications, but it didn't solve the problem. Unfortunally I had to stop using the serialization library and try something else.
Hmmm - have you considered upgrading the compiler? I would be curious to know if the latest BCB is any bettter. 1.34 - to be released "real soon now" has passed almost all tests. Robert Ramey
Robert Ramey wrote:
Federico Feller wrote:
Russell, thanks for your answer. I've tried removing the template specifications, but it didn't solve the problem. Unfortunally I had to stop using the serialization library and try something else.
Hmmm - have you considered upgrading the compiler? I would be curious to know if the latest BCB is any bettter. 1.34 - to be released "real soon now" has passed almost all tests.
I fear this wouldn't help Federico because the newest compiler appears to reach this kind of limit rather sooner than later. Cheers, Nicola Musatti
Well, deadlines forced me to find other solution. So,
waiting for new releases is not really a posibility
for me. Anyway, the right solution for me seems to be
stop using BCB at all...this compiler has show too
many weaknesses (specially compile times)
Thanks a lot for your answers
Greetings
Federico
--- Nicola Musatti
Federico Feller wrote:
Russell, thanks for your answer. I've tried removing the template specifications, but it didn't solve
Robert Ramey wrote: the
problem. Unfortunally I had to stop using the serialization library and try something else.
Hmmm - have you considered upgrading the compiler? I would be curious to know if the latest BCB is any bettter. 1.34 - to be released "real soon now" has passed almost all tests.
I fear this wouldn't help Federico because the newest compiler appears to reach this kind of limit rather sooner than later.
Cheers, Nicola Musatti
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Federico Feller wrote:
Well, deadlines forced me to find other solution. So, waiting for new releases is not really a posibility for me. Anyway, the right solution for me seems to be stop using BCB at all...this compiler has show too many weaknesses (specially compile times) Thanks a lot for your answers
We've taken the same approach. For us, moving to BDS2006 looks like quite a large task, and possibly no real benefit. So we've been given some time to investigate porting the back-end code to VC8 managed dlls and building managed C++ interfaces on to the main objects and we can do a C# interface for it. Most of our back-end code compiles pretty much straight away in VC80 so that part isn't too hard, the C# UI will take longer, but we are planning a UI redesign and re-write soon anyway so it seems like the perfect opportunity. A shame for Borland, but so far am impressed with VC80 and how easy it is to interface from C# in to standard C++ code compiled as a manged DLL. Cheers Russell
participants (4)
-
Federico Feller
-
Nicola Musatti
-
Robert Ramey
-
Russell Hind