From 38c8ca3f376451c072650fad8964adbbc513a105 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 06 Jul 2005 09:29:15 +0000 Subject: fixxxx --- diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 27d37c4..ea49c2c 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -4,8 +4,41 @@ Info about the changes in new versions of KDE-Pim/Pi Fixed a problem in KA/Pi search. Fixed some minor problems in KO/Pi. -Added calendar selection possibility to the todo view popup and to the event/todo editor. - +Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. + +Fixed memory usage problems in KA/Pi: +When loading data KA/Pi did load the file data twice. +Example: + A 600k file did consume 1200k memory during loading process. + This is fixed, it does now consume only 600k during loading process. +When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. +This is fixed. +Example: + Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. + When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. + Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. +Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. + +Fixed memory usage problems in KO/Pi: +When KO/Pi did save the data to file, it did not release the used buffers after saving. +The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. +This is fixed. +Example: + When saving a 400k file KO/Pi do now use 400k less memory now. + +Optimized memory usage in KO/Pi Agenda view: +KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. +These buffers were not made smaller (i.e. downsized) because of performance reasons. +The handling of these buffers are now much smarter: +Two (of six) buffers are removed completely. +The remaing four buffers are now downsized after not using the agenda view for 45 seconds. +Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. + +Worst case example ( for a maximum size agenda content): + When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. + +Summary: +Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. ********** VERSION 2.1.12 ************ diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index b9fe6ff..ec5ed80 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp @@ -27,6 +27,7 @@ $Id$ #include #include +#include #include #include @@ -69,13 +70,12 @@ bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) return false; } + +#include bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) { - kdDebug(5700) << "VCardFormat::loadAll()" << endl; - - QByteArray fdata = file->readAll(); - QCString data(fdata.data(), fdata.size()+1); - + + QCString data(file->readAll().data(), file->size()+1); VCardEntity e( data ); VCardListIterator it( e.cardList() ); @@ -92,7 +92,6 @@ bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFi printf("address %s loaded successfully\n", addressee.formattedName().latin1()); } } - return true; } @@ -115,24 +114,17 @@ void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) { - VCardEntity vcards; - VCardList vcardlist; - vcardlist.setAutoDelete( true ); - AddressBook::Iterator it; + AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { if ( (*it).resource() == resource ) { - VCard *v = new VCard; - saveAddressee( (*it), v, true ); + save((*it),file); + qApp->processEvents(); (*it).setChanged( false ); - vcardlist.append( v ); } } - - vcards.setCardList( vcardlist ); - - QCString vcardData = vcards.asString(); - file->writeBlock( (const char*)vcardData, vcardData.length() ); + // for memory usage status test only + // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); } bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index c56be8b..91df96d 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -197,10 +197,21 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const } QFile file( fileName ); if ( file.open( IO_ReadOnly ) ) { - QByteArray rawData = file.readAll(); + QCString rawData ( file.readAll().data(),file.size()+1); file.close(); - QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); - addrList = parseVCard( data ); + int start = 0; +#ifndef DESKTOP_VERSION + while ( start < rawData.size()-2 ) { + if ( rawData.at( start ) == '\r' ) + if ( rawData.at( start+1 ) == '\n' ) + if ( rawData.at( start+2 ) == ' ' ) { + rawData.remove(start,3); + --start; + } + ++start; + } +#endif + addrList = parseVCard( QString::fromUtf8( rawData.data() ) ); } } -- cgit v0.9.0.2