Jesse op den Brouw (jesse@crytonII.st.hhs.nl)
Mon, 23 Mar 1998 13:10:10 +0100
Does anyone of you use Berkeley DB 1.85 in combination with malloc/free
calls?
If yes, then here is my problem:
I'm using the search engine htdig (http://htdig.sdsu.edu/). Standard,
htdig uses gdbm as its database engine/files. Esa Aloha redecorated
htdig for use with Berkeley DB 1.85 (on a FreeBSD system, he clames
it runs without problem on his machine). It has
some advantage over gdbm. I patched his code into htdig and it
compiled/linked perfectly, but when I run the digger it crashes with
the following, (from xxgdb, on a RH 5.0 system):
Program received signal SIGSEGV, Segmentation fault.
chunk_free () at malloc.c:2776
malloc.c:2776: No such file or directory.
Current language: auto; currently c
When I do a stack trace it gives me:
(xxgdb) info stack
#0 chunk_free () at malloc.c:2776
#1 0x400ac991 in __cfree () at malloc.c:2684
#2 0x8056d95 in DB_db::Get (this=0x806e350, key=@0xbffff71c,
data=@0xbffff72c) at DB_db.cc:219
#3 0x8050186 in DocumentDB::operator[] (this=0x805a71c, u=0x8070a18
"http://localhost/manual/") at DocumentDB.cc:141
#4 0x804d9d5 in Retriever::GetRef (this=0xbffff814, u=0x809cc20
"http://localhost/manual/") at Retriever.cc:502
#5 0x804d193 in Retriever::parse_url (this=0xbffff814,
urlRef=@0x809dbb0) at Retriever.cc:212
#6 0x804d121 in Retriever::Start (this=0xbffff814) at Retriever.cc:188
#7 0x804f604 in main (ac=5, av=0xbffff998) at main.cc:209
Ok, so now for the locals...(xxgdb) info locals
ms = (struct malloc_state *) 0x80709cd
i = 1074785964
b = (struct malloc_chunk *) 0x80709d5
(xxgdb)
??? i = 10747..... Does this mean that free wants to free 1 GB??
Strange??
Now, I looked at the code Esa wrote, but I couldn't find any strange
things:
// int DB_db::Get(String &key, String &data)
//
int
DB_db::Get(String &key, String &data)
{
DBT k, d;
if (!isOpen)
return NOTOK;
k.data = key.get();
k.size = key.length();
int rc = (dbf->get)(dbf, &k, &d, 0);
if (rc)
return NOTOK;
data = 0;
data.append((char *)d.data, d.size);
// note: it crashes on the following free()....
free(d.data);
return OK;
}
Is there a known problem with berkeley DB 1.85?
When linking, does it actualy link against Berkeley DB 1.85 or maybe
against Berkeley 2.x.x (there is a libdb.so.2.0.0)?
Are the libdb.a or libdb.so.x.x.x using the same malloc/free as the rest
of my program/
--jesse
---------------------------------------------------------------------
J. op den Brouw Johanna Westerdijkplein 75
Haagse Hogeschool 2521 EN DEN HAAG
Faculty of Engineering Netherlands
Electrical Engineering +31 70 4458936
-------------------- J.E.J.opdenBrouw@st.hhs.nl ---------------------
Linux - because reboots are for hardware changes
----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.
This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:25:50 PST