home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!karl
- From: karl@NeoSoft.com (Karl Lehenbauer)
- Subject: Re: Dumping/Restoring Interpreter Memory
- Organization: NeoSoft Communications Services -- (713) 684-5900
- Distribution: usa
- Date: Thu, 12 Nov 1992 06:54:30 GMT
- Message-ID: <BxLCJ1.Mw2@NeoSoft.com>
- Keywords: dump restore tcl interpreter
- References: <1992Nov11.163524.12633@stortek.com>
- Lines: 42
-
- In article <1992Nov11.163524.12633@stortek.com> v043332@gandalf.stortek.com (Keith Amann) writes:
- >I have noted that the tclTest program has a function call to
- >Tcl_DumpActiveMemory, but can't seem to locate this function (John, is this
- >not included in the regular distribution?). I believe that this is part of
- >what I am looking for, and I could probably derive the "restore" given this
- >piece of it.
- >Any helpful hints or suggestions would be greatly appreciated. Also, I would
- >prefer something that DOES NOT utilize Extended TCL (no offense intended, I
- >just happen to like to stick to the original).
-
- No offense taken, but pity you feel that way about Extended Tcl -- files,
- arrays and, yes, this Tcl_DumpActiveMemory function you are interested in
- originated there.
-
- Unfortunately for your purposes, Tcl_DumpActiveMemory is part of the
- memory tracking package that, when compiled in, can detect corruption
- problems, usually identifying the filenames and line numbers that
- malloc'ed the areas that became corrupted. Also stuff like freeing
- twice, freeing things that weren't allocated, and such, are detected.
-
- Tcl_DumpActiveMemory can be called at the end of a session and, if there
- are any mallocs that did not have corresponding frees, the filenames, line
- numbers and sizes of the mallocs are printed -- very, very useful for
- finding memory leaks.
-
- As for your plan of traversing the interpreter and grabbing off all of
- the memory, well, it looks possible, but possibly quite difficult.
- Although of course being able to save and restore state on an interpreter-
- by-interpreter basis would be better, something easier to try might be the
- trick where you force a coredump after loading everything and patch up the
- image to make it executable again. Perl has a similar capability -- you
- might have a look at how they did.
-
- With X-windows, though, you'd have to save off before you started much
- in the way of X initialization -- surely you'd have to save sometime
- before starting to communicate with the server. Consider open files
- and data stashed away by other functions behind your back by the C
- library as well.
- --
- -- Email info@NeoSoft.com for info on getting interactive Internet access.
- "It took no computation to dance to the rock 'n roll station."
- -- VU
-