Re[4]: [Gc] Small patch to allow initial and maximum heap sizesto be>2GB.

Ivan Maidanski ivmai at mail.ru
Thu May 28 12:29:59 PDT 2009


Hi!

"Talbot, George" <Gtalbot at locuspharma.com> wrote:
> OK...here you go... (at end of email)
> 
> > Subject: Re[2]: [Gc] Small patch to allow initial and maximum heap sizes
> > to be>2GB.
> >
> > Hi!
> >
> > "Talbot, George" <Gtalbot at locuspharma.com> wrote:
> > > I don't have the ability to build and test on Win32 for the GC.  Can you
> > help me out with that part?
> > >
> > > Is strtoull() available on Win32?
> >
> > You mean strtoul(), right? Yes, it exists everywhere (including WinCE and
> > DOS).
> >
> > But for _WIN64, please, use _strtoui64.
> diff -r1.25 misc.c
> 683a684,688
> > #ifdef __GNUC__
> >         initial_heap_sz = atoll(sz_str);
> > #elif defined (_WIN64)
> >       initial_heap_sz = _strtoui64(sz_str);
> > #else
> 684a690
> > #endif
> 695c701,707
> <         word max_heap_sz = (word)atol(sz_str);
> ---
> > #ifdef __GNUC__
> >         word max_heap_sz = (word)atoll(sz_str);
> > #elif defined (_WIN64)
> >         word max_heap_sz = (word)_strtoui64(sz_str);
> > #else
> >         word max_heap_sz = (word)atoi(sz_str);
> > #endif

Wrong!!!

I meant the following:
For all the current uses of "(word)atoi(str)", it's better to replace them with (word)strtoul/_strtoui64(str, &dummy_ptr, 10) for all Unix/Win32 targets (_strtoui64 is used for _WIN64).
Attention should be payed to (I don't investigate it yet):
1. checking for returned value in case of empty or bad string (is it 0 or -1?);
2. is it (always) safe to pass NULL instead of &dummy_ptr? (or, may be, we should use &dummy_ptr to check for bad str passed?).

Protos for strtoul/_strtoui64:
unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW;
unsigned __int64 __cdecl _strtoui64(__in_z const char * _String, __deref_opt_out_z char ** _EndPtr, __in int _Radix);

Bye.



More information about the Gc mailing list