Re: Bitcoind

I put it at bitcoin.org/download/linux64-0.2.7.1.tar.gz. You can delete it when you’ve got it.

I thought about what might cause the problem you’re having and made a change that this build includes. This might have been unsafe code, although it would probably always get lucky.

in util.cpp, old:

const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         const char* pszTranslated =
             wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, pszTranslated) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(pszTranslated)+1];
         strcpy(pszCached, pszTranslated);
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}

new:

const char* wxGetTranslation(const char* pszEnglish)
{
     // Wrapper of wxGetTranslation returning the same const char* type
     // as was passed in
     static CCriticalSection cs;
     CRITICAL_BLOCK(cs)
     {
         // Look in cache
         static map<string, char*> mapCache;
         map<string, char*>::iterator mi = mapCache.find(pszEnglish);
         if (mi != mapCache.end())
             return (*mi).second;

         // wxWidgets translation
         wxString strTranslated = wxGetTranslation(wxString(pszEnglish,
             wxConvUTF8));

         // We don't cache unknown strings because caller might be
         // passing in a dynamic string and we would keep allocating
         // memory for each variation.
         if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
             return pszEnglish;

         // Add to cache, memory doesn't need to be freed.  We only
         // cache because we must pass back a pointer to permanently
         // allocated memory.
         char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
         strcpy(pszCached, strTranslated.utf8_str());
         mapCache[pszEnglish] = pszCached;
         return pszCached;
     }
     return NULL;
}

If you still suspect this code, for testing you could change it to:

const char* wxGetTranslation(const char* pszEnglish)
{
     return pszEnglish;
}

mmalmi@cc.hut.fi wrote:

I tried debugging my build of bitcoind with ddd debugger, but didn’t have much success yet. It always ends up taking all the system’s memory and finally crashes. Could you please send me again the latest 64 bit build of bitcoind, so I can see if the problem is about my build?

Source: Published by Martti Malmi on GitHub in February 2024 as part of his testimony in the COPA v. Wright trial. The full correspondence archive is available at mmalmi.github.io/satoshi/.