• Welcome to Computer Association of SIUE - Forums.
 

UNIX, memory garbage collection

Started by Peter Motyka, 2002-09-27T16:50:02-05:00 (Friday)

Previous topic - Next topic

Peter Motyka

Now that solar.cs.siue.edu is being used for CS414 I have a few questions about keeping it running well for the students.  Students are writting programs which fork, exec and use shared memory.  Someone has contacted me asking how to be certain memory has been deallocated.  I have seen many products for win32 that claim to "defrag" ram and do other cleanup operations, are there similar utilities for UNIX?  Does the operating system, in this case Solaris 8, do this automatically?

Thanks for any advice :)
Peter
SIUE CS Alumni 2002
Grad Student, Regis University
Senior Engineer, Ping Identity
http://motyka.org

Stiffler

One way is to have students run the programs on a virtual computer like base, so when they exit the VM, all the memory is cleared that it used. Java and C# nativly run on a VM, but you can also put C++ on a VM. I don't remember how though. Also, something called AutoPointers could be used. It's a library add in for C++ that clears all the pointers when they are no longer referenced.

Jon
Retired webmaster of CAOS.

Peter Motyka

Yeah, that is a good option... I guess I was looking for something a bit more dynamic.  Just a tool that would run from the shell and tell you what memory you had allocated and gave you the option to clean up possible memory leaks.
SIUE CS Alumni 2002
Grad Student, Regis University
Senior Engineer, Ping Identity
http://motyka.org

William Grim

Bhatia showed me "ipcs" and "ipcrm".  That's what we should use to detect memory leaks and destroy them.

Heh, that's what I was going to do later anyway.
William Grim
IT Associate, Morgan Stanley