2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Release pooled and in-flight Request objectsand URIResult objects
	in FileEntry after download completed.
	* src/DownloadContext.cc
	* src/DownloadContext.h
	* src/FileEntry.cc
	* src/FileEntry.h
	* src/RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-07-05 09:10:08 +00:00
parent f0edf98651
commit e40d6b7c0f
6 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Release pooled and in-flight Request objectsand URIResult objects
in FileEntry after download completed.
* src/DownloadContext.cc
* src/DownloadContext.h
* src/FileEntry.cc
* src/FileEntry.h
* src/RequestGroup.cc
2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-07-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Set manual and source attribute in aria2c.1.txt Set manual and source attribute in aria2c.1.txt

View File

@ -165,4 +165,12 @@ bool DownloadContext::hasAttribute(const std::string& key) const
} }
} }
void DownloadContext::releaseRuntimeResource()
{
for(std::vector<SharedHandle<FileEntry> >::const_iterator i =
_fileEntries.begin(); i != _fileEntries.end(); ++i) {
(*i)->releaseRuntimeResource();
}
}
} // namespace aria2 } // namespace aria2

View File

@ -235,6 +235,8 @@ public:
// Returns FileEntry at given offset. SharedHandle<FileEntry>() is // Returns FileEntry at given offset. SharedHandle<FileEntry>() is
// returned if no such FileEntry is found. // returned if no such FileEntry is found.
SharedHandle<FileEntry> findFileEntryByOffset(off_t offset) const; SharedHandle<FileEntry> findFileEntryByOffset(off_t offset) const;
void releaseRuntimeResource();
}; };
} // namespace aria2 } // namespace aria2

View File

@ -313,4 +313,11 @@ void FileEntry::reuseUri(size_t num)
} }
} }
void FileEntry::releaseRuntimeResource()
{
_requestPool.clear();
_inFlightRequests.clear();
_uriResults.clear();
}
} // namespace aria2 } // namespace aria2

View File

@ -231,6 +231,8 @@ public:
// reuse, those URIs are used more than once so that num URIs total // reuse, those URIs are used more than once so that num URIs total
// are available to reuse. // are available to reuse.
void reuseUri(size_t num); void reuseUri(size_t num);
void releaseRuntimeResource();
}; };
typedef SharedHandle<FileEntry> FileEntryHandle; typedef SharedHandle<FileEntry> FileEntryHandle;

View File

@ -800,6 +800,7 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
if(!_pieceStorage.isNull()) { if(!_pieceStorage.isNull()) {
_pieceStorage->removeAdvertisedPiece(0); _pieceStorage->removeAdvertisedPiece(0);
} }
_downloadContext->releaseRuntimeResource();
} }
void RequestGroup::preDownloadProcessing() void RequestGroup::preDownloadProcessing()
@ -945,8 +946,6 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
sessionDownloadLength += sessionDownloadLength +=
_segmentMan->calculateSessionDownloadLength(); _segmentMan->calculateSessionDownloadLength();
} }
// TODO1.5 Purge unnecessary data in FileEntry here.
return return
SharedHandle<DownloadResult> SharedHandle<DownloadResult>
(new DownloadResult(_gid, (new DownloadResult(_gid,