summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-04-19 19:49:22 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:58 +0200
commitaf1726c615b5af04e3fe20b8782c1560aac41f7f (patch)
tree60b2b557863400625cd6af50726472a84a63df7e /misc.c
parenta7dc8fe712e7a11ae12ce9ec2b1f3f6faf068f4b (diff)
2011-04-19 Ivan Maidanski <ivmai@mail.ru>
* misc.c (GC_parse_mem_size_arg): New function. * misc.c (GC_init): Use GC_parse_mem_size_arg(). * pthread_stop_world.c (tkill): Declare for Android.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index 51a9248..59bdd12 100644
--- a/misc.c
+++ b/misc.c
@@ -633,6 +633,14 @@ STATIC void GC_exit_check(void)
STATIC int GC_log = 2; /* stderr */
#endif
+STATIC word GC_parse_mem_size_arg(const char *str)
+{
+ char *endptr;
+ word result = (word)STRTOULL(str, &endptr, 10);
+ /* TODO: allow 'k', 'M', 'G' suffix */
+ return result;
+}
+
GC_INNER void GC_initialize_offsets(void); /* defined in obj_map.c */
GC_INNER void GC_bl_init(void); /* defined in blacklst.c */
@@ -941,7 +949,7 @@ GC_API void GC_CALL GC_init(void)
{
char * sz_str = GETENV("GC_INITIAL_HEAP_SIZE");
if (sz_str != NULL) {
- initial_heap_sz = (word)STRTOULL(sz_str, NULL, 10);
+ initial_heap_sz = GC_parse_mem_size_arg(sz_str);
if (initial_heap_sz <= MINHINCR * HBLKSIZE) {
WARN("Bad initial heap size %s - ignoring it.\n", sz_str);
}
@@ -951,7 +959,7 @@ GC_API void GC_CALL GC_init(void)
{
char * sz_str = GETENV("GC_MAXIMUM_HEAP_SIZE");
if (sz_str != NULL) {
- word max_heap_sz = (word)STRTOULL(sz_str, NULL, 10);
+ word max_heap_sz = GC_parse_mem_size_arg(sz_str);
if (max_heap_sz < initial_heap_sz * HBLKSIZE) {
WARN("Bad maximum heap size %s - ignoring it.\n", sz_str);
}