|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Memory Leak/Management DB XML 2.1.8
by Mason, Mark L.
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Hello, Seeing a memory leak. Details included below: Problem
Description: ¨ Database
load utility uses increased amounts of memory during lifetime of
application. Run top
to track %CPU and %MEM for the application. The %MEM value increases at a rate that depends
on the cache size used to set up the database environment. The VIRT variable (virtual memory) stays
constant. Basic information: ¨ O.S.
Fedora Core 3 ¨ x86
architecture ¨ DB
XML version 2.1.8 DB XML Usage: ¨ Load
database. Relevant Internal Data
Classes: ¨ SqlThing class is responsible for
forming XQuery statements and executing them. It joins an already
existing database environment as a client to execute XQuery against a
container. ¨ The
database environment is created/managed by another class called EventDbEnvMgr. The SqlThing class has a EventDbEnvMgr member object named edbem.
edbem creates XmlManager, XmlUpdateContext, and XmlContainer pointer objects on
the heap. And the SqlThing
object accesses two of these dereferenced pointers through get() methods: o
edbem.getXmlCntr() //
Gets dereferenced edbem.XmlContainer o
edbem.getXmlUpdateCntxt() //
Gets dereferenced edbem.XmlUpdateContext Code: ¨ The
database environment is created by the following EventDbEnvMgr method: void EventDbEnvMgr::createEnv() { dbEnv
dbe(0); dbe.set_cachesize(0,
32*1024, 4); dbe.set_lk_max_locks.(100000); dbe.set_lk_max_lockers.(100000); dbe.set_lk_max_objects.(100000); try
{ dbe.open(pathToEnv.c_str(),
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |
DB_RECOVER, 0);
} catch … } ¨ Client
application calls insert() method within SqlThing
class numerous times to load database, one document at a time. May load
up to 100K documents. Documents are not large, and in fact are fairly
small. void
SqlThing::insert(const char *Records) { try
{ std::string
sContent(Records); // //
Exercises XmlContainer.putDocument() method. // edbem.getXmlCntr().putDocument(sInternalDocName.c_str(),
sContent, edbem.getXmlUpdateCntxt(), DBXML_GEN_NAME);
} catch … } ¨ Results: Observe that the Pmem
value reported by top increases much faster when I change the cache size like
this: dbe.set_cachesize(0,
32*1024*1024, 4); // Increased by a factor of 1K How do I plug the leak?
Can I flush the cache? Is the leak within one of the library objects? Or
what? Can the leak be fixed
with a patch without upgrading? Also, I exaggerated the
locking configuration so that all the nodes/leafs can be accessed
simultaneously with a database dump utility. Thanks, Mark Mason Senior Software Engineer General Dynamics Advanced Information Systems 210-442-4246 |
|
|
Re: Memory Leak/Management DB XML 2.1.8
by George Feinberg-3
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Mark,
If you could document a leak using a tool such as valgrind, that'd help. There are no known actual memory leaks in the system that increase with operational load, so I suspect you are seeing an artifact of something else. The cache memory is allocated as shared memory, and will take up more space if the cache is larger. Another thing is that as you put documents in a transactional environment, the log file will grow. Perhaps that's what you are seeing. You can use a Berkeley DB checkpoint operation to flush log data to the backing database. That may affect your statistics. Regards, George On Jul 31, 2006, at 10:24 AM, Mason, Mark L. wrote: > Hello, > > > > Seeing a memory leak. Details included below: > > > > Problem Description: > > > > ¨ Database load utility uses increased amounts of memory > during lifetime of application. Run top to track %CPU and %MEM for > the application. The %MEM value increases at a rate that depends > on the cache size used to set up the database environment. The > VIRTvariable (virtual memory) stays constant. > > > > Basic information: > > > > ¨ O.S. Fedora Core 3 > > ¨ x86 architecture > > ¨ DB XML version 2.1.8 > > > > DB XML Usage: > > > > ¨ Load database. > > > > Relevant Internal Data Classes: > > > > ¨ SqlThing class is responsible for forming XQuery statements > and executing them. It joins an already existing database > environment as a client to execute XQuery against a container. > > > > ¨ The database environment is created/managed by another > class called EventDbEnvMgr. The SqlThing class has a > EventDbEnvMgrmember object named edbem. edbem creates XmlManager, > XmlUpdateContext, and XmlContainer pointer objects on the heap. > And the SqlThing object accesses two of these dereferenced pointers > through get() methods: > > > > o edbem.getXmlCntr() // Gets dereferenced > edbem.XmlContainer > > o edbem.getXmlUpdateCntxt() // Gets dereferenced > edbem.XmlUpdateContext > > Code: > > > > ¨ The database environment is created by the following > EventDbEnvMgr method: > > > > void EventDbEnvMgr::createEnv() > > { > > dbEnv dbe(0); > > > > dbe.set_cachesize(0, 32*1024, 4); > > dbe.set_lk_max_locks.(100000); > > dbe.set_lk_max_lockers.(100000); > > dbe.set_lk_max_objects.(100000); > > > > try > > { > > dbe.open(pathToEnv.c_str(), DB_CREATE | > DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | > DB_RECOVER, 0); > > > > } catch … > > > > } > > > > ¨ Client application calls insert() method within SqlThing > class numerous times to load database, one document at a time. May > load up to 100K documents. Documents are not large, and in fact > are fairly small. > > > > void SqlThing::insert(const char *Records) > > { > > try > > { > > std::string sContent(Records); > > // > > // Exercises XmlContainer.putDocument() method. > > // > > edbem.getXmlCntr().putDocument > (sInternalDocName.c_str(), sContent, edbem.getXmlUpdateCntxt(), > DBXML_GEN_NAME); > > > > } catch … > > } > > > > ¨ Results: > > > > Observe that the Pmem value reported by top increases much faster > when I change the cache size like this: > > > > dbe.set_cachesize(0, 32*1024*1024, 4); // Increased by a factor of 1K > > > > How do I plug the leak? Can I flush the cache? Is the leak within > one of the library objects? Or what? > > > > Can the leak be fixed with a patch without upgrading? > > > > Also, I exaggerated the locking configuration so that all the nodes/ > leafs can be accessed simultaneously with a database dump utility. > > > > > > Thanks, > > > > Mark Mason > > Senior Software Engineer > > General Dynamics > > Advanced Information Systems > > 210-442-4246 > > > > ------------------------------------------ To remove yourself from this list, send an email to xml-unsubscribe@... |
| Free Forum Powered by Nabble | Forum Help |