I am using TBB to allocate memory for C structures and same is exposedto Java using JNI. The pointers becomes Java integers (which actually represents the pointers in native layer).Ihave following doubts.
1. In Java an integer is a32 bit signed value always. So can I restrict the address range of TBB allocation so thatit will never exceed the range 2^31 - excluding the sign bit.
2.From Java,now user can pass a random integer which will be considered as a pointer in native layer.
Does TBB provide a mechanism to check a particularvalueagainst theinternalmemory address range (block) and tellthe passed invalue isa valid pointer or not.
Of course , there can be valid reasons. If you read my original question completely, it is about exposing native pointer to Java. Mine is a native library. So a java user can be be mischievous (but often by mistake)to pass a random integer to native layer as valid handle. Without such a mechanism, you cannot trust such a value. This is true for native applications also. But there compiler assists to some extend.