public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/5492: basic_string allocator problem
@ 2002-01-25  9:56 kk71878
  0 siblings, 0 replies; 2+ messages in thread
From: kk71878 @ 2002-01-25  9:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: kk71878


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/5492: basic_string allocator problem
@ 2002-01-25 15:46 Carlo Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Carlo Wood @ 2002-01-25 15:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/5492; it has been noted by GNATS.

From: Carlo Wood <carlo@alinoe.com>
To: kk71878@hotmail.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/5492: basic_string allocator problem
Date: Sat, 26 Jan 2002 00:38:09 +0100

 On Fri, Jan 25, 2002 at 11:46:37AM -0600, kk71878@hotmail.com wrote:
 > 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.
 
 This sounds like a bug in the persistent object library,
 what makes you think it is a bug in libstdc++?
 
 >                                            (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 have written a string class that replaces the allocator
 and it works for me.  You can see what I did by checking out
 module libcwd from cvs and looking at the file private_allocator.h
 and private_internal_string.h.
 
 My first thought is that you have forgotten to define
 a rebind<> member template.
 
 For info on how to obtain libcwd from cvs, see
 http://libcw.sourceforge.net/debugging/
 
 Regards,
 
 -- 
 Carlo Wood <carlo@alinoe.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-25 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-25  9:56 libstdc++/5492: basic_string allocator problem kk71878
2002-01-25 15:46 Carlo Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).