Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 57129

Summary: Excessive memory usage (RAService.exe)
Product: z_Archived Reporter: Curtis d'Entremont <curtispd>
Component: HyadesAssignee: Dave Smith <smith>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Curtis d'Entremont CLA 2004-04-01 16:51:49 EST
Using 3.0.M8_20040330_0946 data collector.

I'm finding that this data collector, specifically the RAService.exe process is 
routinely using excessive memory (350MB+, I've seen 800MB). It starts out at 
about 4.5MB, which is fine, but then each time I profile a simple helloworld 
app then terminate the app, it is using about 60MB more than it was before I 
started profiling. This keeps accumulating each time I profile.

This seems like a lot of memory for some very simple tasks.
Comment 1 Robert Danek CLA 2004-04-06 12:46:27 EDT
This looks like a memory leak. It's possible that if the memory usage gets too
high, that eventually a shared memory connection between the java profiler and
the RAC cannot be created, which will result in no data appearing in the views.
(See bug 56183, where this was also discussed). 
Comment 2 Richard Duggan CLA 2004-04-16 02:53:13 EDT
Not a memory leak.  This is the shared memorychannel lingering.

Dave,

It looks like the shared memory is not being cleaned up when some exit 
condition occurs.  We need to make sure these puppies get cleaned up in all 
conditions as they are 64MB each by default.
Comment 3 Dave Smith CLA 2004-04-16 18:11:52 EDT
I couldn't reproduce this problem with the 3.0.M8_20040331_1118 hyades data 
collection engine.  Can you please try that version.  When you said "then 
terminate the app", what did you mean by that?
Comment 4 Curtis d'Entremont CLA 2004-04-19 11:17:42 EDT
I couldn't find the driver mentioned on hoplite4, so I re-tested using a more 
recent one (3.0_20040419_0915). I'm using the following sample application that 
repeatedly just calls a method:

public class SimpleTest {
	public static void main(String[] args) throws Exception {
		while (true) {
			call();
			Thread.sleep(300);
		}
	}
	
	public static void call() {
		for (int i=0;i<10;++i)
			doSomething(i + "");
	}
	
	public static void doSomething(String arg) {
		for (int i=0;i<arg.length();++i)
			;
	}
}


Here's how I'm launching it:

- First, note the memory usage of the RAService process.
- In the profiling & logging perspective, click on the profile toolbar icon 
menu -> Profile...
- Double click "External Java Application".
- Specify the SimpleTest app shown above.
- In the Profiling tab, select the Execution History profiling set.
- Click Run.
- After the agent shows up in the profiling monitor and has collected some 
data, right click on it and select Terminate.
- Note the memory usage of RAService is now ~60M higher than it was.
Comment 5 Dave Smith CLA 2004-04-26 00:00:31 EDT
Found in Curtis' scenario, ra_flushShmToFD returns an error code to the shared 
memory flusher function shmFlusher in RACommS.c.  The function then ended 
without releasing the shared memory.  I changed the code to always execute the 
cleanup code, even if the flushing ended with an error code.  The code will now 
issue a warning message to the log if flushing ends with an error.

Committed change to Head stream. 
Comment 6 Curtis d'Entremont CLA 2004-04-27 12:19:46 EDT
Verified in 3.0_20040427_0845.
Win2k
Comment 7 Dave Smith CLA 2004-04-27 14:33:57 EDT
Fixed in M9