[comp.sys.ibm.pc] Garbage in the data segment?

mark@intek01.UUCP (Mark McWiggins) (12/02/89)

I have an application (C++ startup routine) that scans thru the data
segment looking for a certain marker string embedded in a structure with
the addresses of routines that need to be called.

This mostly works, but on rare occasion if I run a C++ application just 
after linking a program, the application hangs.  Adding debugging code to
the startup routine shows an extra marker string being found in the data
area.  If I reboot and run the application immediately afterward, it
works fine.  Running a little "clean" program after the link that just does

	 calloc(1000,1);

in a loop until it can't get any more also keeps the application from
hanging.

This implies to me that the linker is doing something like rounding out 
data segments for initialized data to some boundary, perhaps paragraphs, 
without initializing the padded space, meaning that the padded space contains 
just whatever garbage happened to be in memory.

This is happening with Microsoft C 5.1 and LINK v3.65.  Any insight into
this would be appreciated.  Various workarounds suggest themselves, but
it would be nice to know the details of what I'm dealing with before I
get too involved in trying them.

Thanks in advance.


-- 
Mark McWiggins			Integration Technologies, Inc. (Intek)
+1 206 455 9935			DISCLAIMER:  I could be wrong ...
1400 112th Ave SE #202		Bellevue WA  98004
uunet!intek01!mark		Ask me about C++!