COMMON: Use better reallocation strategy in MemoryWriteStreamDynamic.
Fixes bug #6983: "SWORD25: long saving time"
This commit is contained in:
parent
674a208a7e
commit
f1fa8ea1ca
1 changed files with 2 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
#include "common/util.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
|
@ -170,7 +171,7 @@ private:
|
||||||
|
|
||||||
byte *old_data = _data;
|
byte *old_data = _data;
|
||||||
|
|
||||||
_capacity = new_len + 32;
|
_capacity = MAX(new_len + 32, _capacity * 2);
|
||||||
_data = (byte *)malloc(_capacity);
|
_data = (byte *)malloc(_capacity);
|
||||||
_ptr = _data + _pos;
|
_ptr = _data + _pos;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue