Robert Burrell Donkin ha scritto: > https://issues.apache.org/jira/browse/JAMES-734 discusses the general > design of the API > > one major issue for IMAP ATM is that when FETCHing a large quantity of > data, all that data has to be loaded into memory and then the full > result created in a StringBuffer before the output begins. this uses a > lot of memory. > > there are different ways to approach this issue. IMHO using arrays, > lists or iterators is as much a matter of style than substance. > > one approach would be to use result objects which are lazily > populated. this would be reasonably easy for Torque. this would also > mean either adding a close() operation or making the content objects > read-once allowing the result to recycle the memory.
It seems Iterator is the right interface for this scenario. Once you call next() the previous result is unrefereced. Using iterator we don't need close() because they are already "read-once", right? Arrays are not an option because we cannot encapsulate an array so we cannot lazyload it. Do we need to know the size() at the beginning or we can just loop while there are new results? If we need the size Iterator is not enough and we probably need a List, otherwise I would go with Iterator. Stefano > part of the solution must be to move to a design that allows each line > to be written once out when it has been composed. the interface > changes i've made to the new IMAP implementation are directed at this. > > opinions? > > perferences? > > - robert --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
