This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/5492: basic_string allocator problem



>Number:         5492
>Category:       libstdc++
>Synopsis:       basic_string seems to fail to use template-defined allocator.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 25 09:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Killingsworth
>Release:        3.0.3
>Organization:
Utilicorp
>Environment:
System: Linux fenix 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure 
>Description:
I am using a persistent object storage library to allocate memory using mmap().
Using this process, I can define allocators for all STL objects.  I defined
a new typedef (pstring) which is identical to string except that it uses
the new allocator.  This completely works with STLPort.  It compiles completely
with gcc 3.0.3, but when the program is stopped and re-started (re-loading the
data from the storage file, I get a valid basic_string object, but the data
within it is not valid.
>How-To-Repeat:
You should be able to reproduce this error by using any allocator other than
default and the tracking which one is used (my inclination is that
basic_string's data is being allocated by the default allocator regardless
of any allocator passed as a template parameter)
I reproduced this problem by using the POST++ library with a 
modified post_stl.h.
POST++'s site is available at http://www.ispras.ru/~knizhnik/post.html
I contacted Konstantin Kriznik, the author of this library and he too was
unable to get it to work with gcc 3.0.3.  If, for some reason you need a copy
of the post_stl.h I was using, I am available at kk71878@hotmail.com
>Fix:
Honestly, I'm using an XML import/export for saving data instead of the
persistent storage.  If I can't get this resolved, I may have to come up with a
work-around such as creating a new string class which doesn't have issues
with the persistent storage allocator.  (perhaps just a wrapper for basic_string
which keeps its data as a char * buffer.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]