-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed memory size caluclation problem.
See #149
- Loading branch information
Showing
10 changed files
with
70 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,12 @@ void* msgpack_zone_malloc_expand(msgpack_zone* zone, size_t size) | |
size_t sz = zone->chunk_size; | ||
|
||
while(sz < size) { | ||
sz *= 2; | ||
size_t tmp_sz = sz * 2; | ||
if (tmp_sz <= sz) { | ||
tmp_sz = size; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bipulr
|
||
break; | ||
} | ||
sz = tmp_sz; | ||
} | ||
|
||
msgpack_zone_chunk* chunk = (msgpack_zone_chunk*)malloc( | ||
|
@@ -218,4 +223,3 @@ void msgpack_zone_free(msgpack_zone* zone) | |
msgpack_zone_destroy(zone); | ||
free(zone); | ||
} | ||
|
Are you sure it should NOT be "sz = size" here as in other similar places in this commit. I do not see any point to set tmp_sz here when next statement is to break the loop.
Also what is the point of "if (tmp_sz <= sz)" check?? Will it be ever true given "tmp_sz = sz*2" statement just above that??