Dear All,

I have the complex task to develop a webpage GUI for a java/c++ app, i.e.
the java app contains objects that wrap c++ classes of a .so library. For
example the Frame.java class wraps a corresponding c++ class frame.h (which
does the math). Therefore we call in the constructor of the Frame.java class
a c++ constructor through JNA and store the Pointer in a field.

public class Frame {
    private Pointer cppPointer;
    public Frame() {
        cppPointer = Wrapper.INSTANCE.frameConstructor(...)  // JNA call to
c++ constructor retrieving the c++ pointer.
    }
}

On the webpage, I have the following scenario in which we display a demo
page which renders a 3d view. The user is able to displace an object which
position is determined by the fields of Frame.java and hence the c++
classes. Moving the object is done by changing 'values' in a form. Each of
these 'values' directly modify the Frames and hence the Frame c++-class's
attributes.

In order to have the pointers created only once per page, we construct all
the pointers in the constructor of the page and store them in a model which
serializes the addresses. This allows to have the c++ side created only once
on the page. This seems fine until we have to destroy the pointers memory. 

How to determine when we leave the page in order to destroy the Pointers?
How would you manage this scenario? is it a good thing to construct the
pointers in the constructors of the page? When would you allow to destroy
the c++ allocated memory?

Thanks

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to