Ensure selected page size works with allocate_string
Previously setting a large page size (i.e. 1M) would cause dynamic string allocation to assert spuriously. A page size of 64K guarantees that all offsets fit into 16 bits.
This commit is contained in:
parent
aa1a61c59f
commit
e3c215b542
1 changed files with 2 additions and 0 deletions
|
@ -400,6 +400,8 @@ PUGI__NS_BEGIN
|
|||
|
||||
char_t* allocate_string(size_t length)
|
||||
{
|
||||
PUGI__STATIC_ASSERT(xml_memory_page_size <= (1 << 16));
|
||||
|
||||
// allocate memory for string and header block
|
||||
size_t size = sizeof(xml_memory_string_header) + length * sizeof(char_t);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue