Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / March 2006

Tip: Looking for answers? Try searching our database.

java.lang.ref.SoftReference missing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nathan Baulch - 09 Mar 2006 00:43 GMT
I'm trying to compile a Java project in Visual Studio however it would seem
that J# doesn't have an implementation of the java.lang.ref.SoftReference
class (which I imagine would be a simple wrapper over the top of a
System.WeakReference).

I'm trying to keep the project as close as possible to pure Java (ie, only
reference vjslib.dll and not mscorlib.dll) however it looks like I'll have
to contaminate it by migrating the SoftReferences to WeakReferences.

Nathan
Bruno Jouhier - 11 Mar 2006 15:32 GMT
SoftReferences and WeakReferences have different semantics:

Objects referenced through weak references go away as soon as you don't have
any strong references to them (at the next GC pass).
Objects referenced through soft references go away when the memory starts to
fill up, if they don't have strong references pointing to them. So, they
don't go away at the next GC pass if the memory pressure is low.

So, soft references are much more practical than weak reference for caching,
and you will need to do some extra work (keeping extra strong references and
breaking them when memory pressure gets high) if you want to reproduce the
soft reference behavior with weak references.

2 reasons why J# does not have soft references:

* it is based on JDK 1.1.4, which did not have soft references.
* the .NET framework (even 2.0) only provides weak references.

Bruno

> I'm trying to compile a Java project in Visual Studio however it would
> seem that J# doesn't have an implementation of the
[quoted text clipped - 6 lines]
>
> Nathan

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.