Hi, I've not dabbled with per-thread repositories, so take-with-a-pinch-of-salt, but :
a) Are the threads coming from a pool ? b) Do you ever mm.setDescriptor(null); ? A quick scan of the source suggests that the per-thread descriptors are stored in a ThreadLocal, so mm.copyOfGlobalRepositor() clones the repository, mm.setDescription(dr) stores it in a map keyed by the the tread (== ThreadLocal). If the threads are always new threads, the map will grow like topsy. However, if you do a mm.setDescriptor(null) after you've finished on the thread, presumably the space will be gc'd. This could, of course, be a pile of old rubbish, in which case : at least I tried. Cheers, Charles. > -----Original Message----- > From: Janssen, Roger [mailto:[EMAIL PROTECTED] > Sent: 17 November 2003 16:27 > To: 'OJB Users List' > Subject: RE: [rc4 / BUG] major memory leak in MetadataManager > > > i use the following code to change the mapping: > > MetadataManager mm = MetadataManager.getInstance(); > // tell the manager to use per thread mode > mm.setEnablePerThreadChanges(true); > > // e.g we get a coppy of the global repository > DescriptorRepository dr = mm.copyOfGlobalRepository(); > > // now we can manipulate the metadata of the copy > > ... modify mappping > > // set the changed repository for this thread > mm.setDescriptor(dr); > > > when i change the mapping and then create a PersistenceBroker > and then > build a query and query, i am in trouble, 9MB per iteration > disappears. > > when i change the line : > DescriptorRepository dr = mm.copyOfGlobalRepository(); > into > DescriptorRepository dr = mm.getRepository(); > > which means, i'm using the global repository (of which > a reference will be stores as ThreadLocal), at least there are > no leaks and 300 iterations (change mapping, create broker, > build query > and query) are executed within 15 seconds! > > again, only creating a broker after changing the mapping is > no problem, > it's after the execution of a query when the trouble starts. > > i do use my own wrappers around OJB so i'm checking this code as well, > but so far, i have not come up with anything. > > > Roger Janssen > > > ************************************************************** > *********** > The information contained in this communication is confidential and is > intended solely for the use of the individual or entity to whom it is > addressed.You should not copy, disclose or distribute this > communication > without the authority of iBanx bv. iBanx bv is neither liable for > the proper and complete transmission of the information has > been maintained > nor that the communication is free of viruses, interceptions > or interference. > > If you are not the intended recipient of this communication > please return > the communication to the sender and delete and destroy all copies. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > ___________________________________________________________ HPD Software Ltd. - Helping Business Finance Business Email terms and conditions: www.hpdsoftware.com/disclaimer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
