where does the memory go?
- Posted by Colin Taylor <71630.1776 at COMPUSERVE.COM> Oct 07, 1997
- 772 views
This little program gobbles up over 2megs of RAM, and won't give it back.= = Where is the dynamic memory allocation? Colin Taylor --< start code >-- include get.e include memory.e -- by J. Deschenes sequence seq, size integer xms, last, key seq =3D {} size =3D "small" xms =3D FreeXMS() procedure show_mem() last =3D xms xms =3D FreeXMS() printf(1, "%s sequence, ", {size}) printf(1, "free XMS =3D %d, ", xms) printf(1, "change =3D %d\n", last-xms) end procedure -- show_mem function xyz(sequence s) return s*1 end function -- xyz clear_screen() puts(1, "Press a key; or l for large seq, s for small seq, q to quit\n") while 1 do show_mem() seq =3D xyz(seq) key =3D wait_key() if key =3D 'l' then seq =3D repeat({1}, 25000) -- make large sequence size =3D "large" elsif key =3D 's' then seq =3D {1} -- make small sequence size =3D "small" elsif key =3D 'q' then exit end if end while --< end >--