spring: develop 9e46cbe4 | [ Diff ] [ Back to Repository ] | |||
Author | Committer | Branch | Timestamp | Parent |
---|---|---|---|---|
Tobi Vollebregt | Tobi Vollebregt | develop | 2012-07-08 13:15:23 | develop ce368c3e |
Changeset | Fix Spring trying to allocate 2G of RAM during loading Up to now, in CFileHandler, std::ifstream::tellg has typically returned 4096 for directories, after a seekg to the end of an input stream for a directory. However, on my system it returns 2147483647. In either case, 1) when locating the file "" in a data directory, this always succeeded because access( data dir path + "" ) succeeds, and 2) Spring considered a *directory* an existing and readable *file*. Combined, this had the effect that CFileHandler("").FileExists() == true, which led Spring to allocate a 4096 or 2147483647 bytes for unspecified textures (e.g., grass texture in some maps). With the 4096 byte buffer this was not a problem, as IL would simply fail to load the bitmap, but the allocation of 2147483647 bytes obviously fails on some systems... Fixed by making FileSystemAbstraction::IsReadableFile invoke FileExists to check if the path is a directory. (i.e., assuming "directory" and "file" are orthogonal for us) |
|||
mod - rts/System/FileSystem/FileSystemAbstraction.cpp | [ Diff ] [ File ] |