[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Re: [Axiom-developer] system::getenv does not return MSYS en
[Gcl-devel] Re: [Axiom-developer] system::getenv does not return MSYS environ ment variables
08 Dec 2004 10:16:07 -0500
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
"Page, Bill" <address@hidden> writes:
> I also looked at the GCL code for getenv in main.c and I
> noticed a scary section involving a call to free on the
> pointer returned by the system getenv call. I imagine that
> would really mess up Windows memory - but as far as I can
> tell that option is not used during the Windows build.
Some thoughts on memory management in this context:
1) The free of the getenv pointer is not ifdef'ed in on any current
platform. On some older systems the string was allocated via
malloc in libc.
2) malloc/free are redirected in gcl to natively supplied heap
allocation functions. All pointers are between DBEGIN and
3) If memory serves, Windows, like macosx, emulates sbrk. Perhaps
Mike can fill in the details as to the mechanics whereby the heap
is expanded here.
4) If one suspects overwriting the environment, it would be useful for
one to compile a debugging gcl, break at siLgetenv, make a test
call to (si::getenv...) and look at the address of the pointer
returned by getenv. Or in Bill's C program.
5) Bill is doing a terrific job! As is Mike!
Camm Maguire address@hidden
"The earth is but one country, and mankind its citizens." -- Baha'u'llah