How to avoid running out of memory in high memory usage application? C / C++

前端 未结 15 2215
天命终不由人
天命终不由人 2021-02-19 14:04

I have written a converter that takes openstreetmap xml files and converts them to a binary runtime rendering format that is typically about 10% of the original size. Input file

15条回答
  •  天涯浪人
    2021-02-19 14:13

    If you want to be memory-size independent, you need a size-independent algorithm. No matter what size your RAM is, if you don't have memory usage under control, you're going to bump into the border.

    Take a look at the least chunk of information you can possibly use to produce a bit of output. Then think of a way to divide the input into chunks of this size.

    Now that sounds easy, doesn't it? (Glad I don't have to do it :) )

提交回复
热议问题