incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akash Ashok <thehellma...@gmail.com>
Subject Re: Memory Deallocation Issue
Date Thu, 20 Oct 2011 08:08:48 GMT
There is a way to free this memory. We will need to extend ByteBuffer to do
this. finalize() method actually deallocates memory. But its a protected
member.
http://stackoverflow.com/questions/1854398/how-to-garbage-collect-a-direct-buffer-java

So we might have to allocate a new Buffer and terminate the old one. This is
gonna be expensive but since this is not done too often it should be ok.

Have opened a JIRA for this.
https://issues.apache.org/jira/browse/DIRECTMEMORY-24

 Also could you please give me developer access and add me as a contributor
so that I can assign tickets and submit patches ?

Cheers,
Akash A

On Thu, Oct 20, 2011 at 1:26 PM, Raffaele P. Guidi <
raffaele.p.guidi@gmail.com> wrote:

> It is not casual. I didn't find a way to free a DirectBuffer except than
> stopping the jvm. Please double check it, ten talented programmers are
> better than a dumb one ;-)
>
> On Thursday, October 20, 2011, Akash Ashok <thehellmaker@gmail.com> wrote:
> > I currently see that we have
> >
> > Cache.java
> > public static void clear() {
> > for (OffHeapMemoryBuffer buffer : buffers) {
> > buffer.clear();
> > }
> > activeBuffer = buffers.get(0);
> > }
> >
> > OffHeapMemoryBuffer.java
> >
> > public void clear()  {
> > allocationErrors = 0;
> > pointers.clear();
> > createAndAddFirstPointer();
> > buffer.clear();
> > used.set(0);
> > }
> >
> > buffer.clear() doesn't actually deallocate the memory. I assume currently
> we
> > dnt have the feature of de-allocating memory which means that we can't
> > resize the cache once instantiated even if we want to. I feel we should
> have
> > this feature  which would give deeper control on the Cache.
> >
> >
> >
> > Cheers,
> > Akash A
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message