Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5947051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:54:36+00:00 2026-05-22T16:54:36+00:00

Good afternoon, We are building a prototype of a deduplication program with C++ on

  • 0

Good afternoon, We are building a prototype of a deduplication program with C++ on Windows and Linux. Yesterday, we posted a question on Stack Overflow about how to avoid the STL string deep copying when we store a std::string version of a record to deduped in the std::string* StringArray, STL makes a deep copy of the string and mallocs a new buffer of at least 160,000,000 bytes. We quickly run out of heap memory and get a std::bad_alloc exception

The Stack Overflow experts who answered out question recommending using a better string class such as SGI’s Ropes becuases Ropes is buit especially for handling very large strings. So we downloaded a version of SGI’s ropes.c and rope.h. However, we could not compile ropes.c and ropes.h on Windows Visual Studio 2008. Also, we couldn’t find any examples of how to use the SGI C++ Ropes interface.

So we downloaded a Better String Library by Paul Hsieh. we modified our STL source code to use the bstring class implemnted in a Better String Libary. Here is an excerpt of our code:

std::vector< bstring > BStringVector;

bstring b = bfromcstr(curr.getPtr());
char* const resultptr = (curr.getPtr() + n);
resultptr[STRING_SIZE] = '\x0';

BStringVector.push_back(b);
curr.mPtr = (char*)bstr2cstr(BStringVector.back(),' ');

std::multiset<Range>::iterator miter = ranges_type.lower_bound(Range(n));
(*miter).mPtr = curr.mPtr;

free (b);
return (char*)(resultptr); 

This new code generates fewer std::bad_alloc exceptions than the STL string class, But we know Ropes is the best class for handling very large strings. So we need to know how to use the SGI source on Windows Visual Studio 2008. There are a lot of SGI specific header files in the Ropes code. What are the corresponding Windows Visual Studio 2008 C++ header file?

Also, after reading the Ropes documentation we are still not 90% positive about how to convert the null-terminated contents of a C/C++ char* pointer to a Ropes object. In addition, how do we push_back a Ropes object onto a STL container such as vector? Finally, how do we retrieve the Ropes object from the STL vector container? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:54:36+00:00Added an answer on May 22, 2026 at 4:54 pm

    Did you download only the two implementation files? I doubt that this would work as they most likely rely on other files that are part of the SGI STL implementation. That would explain why you can’t build them…

    The easiest way to get at the SGI rope implementation might be to use STLport, which is a port and further development of the SGI STL to multiple platforms. I haven’t tried using it with VS2008 though, but I’m pretty sure it’s supported.

    However, you will need to use STLport as a complete STL replacement (which it is) instead of extracting one or two classes and attempt to use that with the STL implementation that ships with VS2008.

    That is, unless you fancy rewriting the rope classes to work out of the box with the MS STL, but that doesn’t sound like a good idea to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good afternoon, We are building a prototype deduper for Centos Linux Release x86_32 and
Good afternoon, I am currently starting to think & prototype about a (.net based)
Good afternoon, We are building a prototype of a deduper. We are using a
Good afternoon, I have a quick 'top level' question regarding the usage of Facebook
Good afternoon all, I am building a function that takes a string as input,
Good afternoon, We are trying to build a prototype of Memory Mapped File Caching
Good afternoon. I am writing a small to medium-sized python program for my job.
Good afternoon, I would ask some suggestion about the best way to monitor events
Good Afternoon Developers, Just a quick question (I hope!) I am creating an XSLT
Good Afternoon in my timezone. I have a simple question. I have an ArrayList

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.