instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 16, 2018, 10:37:29 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: EAI Memory Issue in Mac  (Read 4330 times)
pyth7
Jr. Member
**
Posts: 86


View Profile
« on: November 09, 2008, 01:26:58 am »

Hi,
It seems my Instant Player app on my Mac has a problem clearing memory
when loading a series of Proto Instances from CreateVRMLFromString when it is closed.
The attached zip contains the test files to demonstrate the problem.
Clicking the red cylinder will CreateVRMLFromString of a Proto Instance
from Test_Worlds at one per second. There are three Test_Worlds, but they all have the same Proto (Avatar5) just in different colors. The TouchSensors are enabled and disabled via EAI, so they may not show up at different times.

Mac:
Unzip in Applications folder: as "CVFU_Mac_Bug" and double click the
MainLaunch.sh file.

Windows:
Unzip as C:/CVFU_Mac_Bug and double click the MainInstantPlayer.bat file.

When the "Clear World" blue cylinder is clicked and the world is cleared initially AND THEN Instant Player is closed everything seems to be ok.
However if nine of the Protos are loaded and Instant Player is closed
without the world being first cleared by the blue cylinder, while Instant Player may not crash the first time per se, the "DefaultScene.wrl" will not appear normal. It will appear very close.

When the test is then continued and repeated WITHOUT quiting Instant Player from the top bar, then even after clearing the world with the blue cylinder and closing Instant Player the "DefaultScene.wrl" will appear black!
If the world is not cleared by the blue cylinder Instant Player may just simply crash.

The window's version does not suffer the same issues. It closes and restarts fine whether the world is cleared or not.

The Mac I am testing on is an IMac PowerPc G5 1.8 ghz
with 1 GB SDRAM and ATI Radeon 9600 128 graphics card.

The attached CVFU_Mac_Bug test is an attempt to isolate the bug of a larger EAI project. The larger project puts the Proto Instances in instances of a class which in turn is placed in both synchronized and un
synchronized Hashtables and this test does the same. So far this test comes closest (but not exactly) to duplicating the bug -the other tests have been too simple.

Finally, in the trivial department: each created instance has a LOD'd Text field above it. Mac Instant Player seems to have a shorter idea of when to switch levels!


Thanks!
Russ Kinter


 
« Last Edit: November 09, 2008, 02:17:09 am by pyth7 » Logged
pdaehne
Administrator
Sr. Member
*****
Posts: 250


View Profile
« Reply #1 on: November 14, 2008, 04:06:14 pm »

Hello Russ,

I can reproduce your problem on my Mac. I did some debugging, but until now I've not been able to fix the bug. There are known problems/memory leaks with PROTOs, so I guess that's the reason. But I fear I cannot give you a quick solution Sad

In general, there is no difference between the Mac and the Windows version, besides the (minimal) user interface. Both versions use the same code. So the bug probably also exists on Windows, but does not show up for some reason.

Regarding the LOD, it should behave identically on Mac and Windows, it's the same code -- when using the same version (build number!) of Instant Player on both operating systems. They might behave differently when using different build numbers - I've changed some bugs in the LOD implementation during the last weeks, so when you got one of the dailybuild versions from that period, there might be differences.

Thanks for the bug report and sorry for the inconvenience,

Patrick
Logged
pyth7
Jr. Member
**
Posts: 86


View Profile
« Reply #2 on: November 14, 2008, 08:54:42 pm »

Thanks Patrick for trying and replying.
I know Protos are one of the toughest things to implement in a X3D/VRML
viewer.
In regards to Windows, I don't know if this bit of info will help, but I discovered that in Windows everything has to be cleared at exactly same time -both the Hashtables clear() and the Root Node's removeChildren( MFNode [] foo )
If I delay one of those actions, then Windows will have the same problem as Mac.
Reloading the root world with loadURL tends to alleviate the issue in both OS but of course that can't be done when the window is simply closed by
the end user.

   Thanks again!
   Russ Kinter





Logged
pyth7
Jr. Member
**
Posts: 86


View Profile
« Reply #3 on: November 16, 2008, 02:45:24 am »

It turns out there is a quick and dirty solution that is also an end-user
convenience. Since the memory issue causes grief only when InstantPlayer window is closed and re-opened on Mac and since my Java EAI app is in a seperate window from InstantPlayer and since forcing an end-user to have to close two windows makes for griping, then the quick and the dirty kills two issues with one .exec():

// during init():

String sShutdown;
String sOS1 = System.getProperty("os.name").toLowerCase();
 if(sOS1.indexOf("windows")!=-1){
sShutdown = "cmd.exe /E:1900 /C Tskill InstantPlayer";
 }
 else {
sShutdown = "killall InstantPlayer";
 }

// part of WindowListener Interface:
// also  code something similar in onBrowserChanged 
// for BrowserEvent.CONNECTION_ERROR as well.
// Although using a shutdownhook might be better and can do more.

public  void windowClosing( WindowEvent e ) {
  try {
 Runtime.getRuntime().exec( sShutdown );
   }
catch(IOException f){ }
   System.exit(0);
}

thanks
Russ Kinter
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines