Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
The QResourceFileEngine, src/corelib/io/qresource.cpp, seems inefficient memory wise, which become noticeable especially on low-memory devices such as in the case of Symbian. Issues:
Problem: Resource files are uncompressed completely into memory, not loaded incrementally/streamed. This means that opening a large file on a constrained device will not even work; heap allocation limitations or memory limits says no.
Solution: Different approaches:
1) Files larger than a certain threshold could be compressed in chunks/windows such that each chunk could be seeked/allocated separately.
2) It is determined at compile time whether compression has any noticeable effect on the file, and is only done if so. In that case the file doesn't have to be heap allocated again in memory, and can remain paged on disk on operating systems which has that functionality.
Problem: Correct me if wrong, but opening a file N times, leads to N heap allocations. I cannot find a cache, and see no reason for a cache to not be used since the engine supports read only files anyway. In the hypothetical case of supporting writable resource files, a copy-on-write design could be used.
Solution: Use a simple, locked hash table to arrange a cache.
Perhaps the above problem space can be seen directly as a virtual memory/paged system, and hence re-apply the solutions and theory relevant to those areas.
This was discovered while adding resource support to Symbian's MMF-based Phonon backend, QTBUG-6562.
Attachments
Issue Links
- relates to
-
QTBUG-48591 Can not load large external resource files on Android
- Closed