[omniORB] Stack Allocation of Primitive Type Arrays
Armen Yampolsky
ayampolsky@erols.com
Mon, 26 Apr 1999 19:39:36 +0000
Hi!
We've noticed an interesting discrepancy of a very simple scenario as
implemented on Solaris 2.6 and Linux. In brief, we are allocating a
private array of primitive type data and exposing an IDL method for
access. We find that, on Solaris, when the array is larger than a
certain number (8172) and stack allocated, our java client does not get
correct values. The pertinent code is very simple, and looks like this:
--- IDL ---
interface Data {
long getDim();
float getCell(in long index);
};
--- C++ servant ---
//const CORBA::Long DIM = 8172; // OK
const CORBA::Long DIM = 8173; // no good on Solaris
class Data_impl : public virtual _sk_Data {
private:
CORBA::Float _f[DIM];
public:
Data_impl();
~Data_impl();
CORBA::Long getDim();
CORBA::Float getCell(CORBA::Long);
};
Data_impl::Data_impl() {
for (CORBA::Long i = 0; i < DIM; i++) {
_f[i] = (CORBA::Float)i;
}
}
CORBA::Long Data_impl::getDim() {
return DIM;
}
CORBA::Float Data_impl::getCell(CORBA::Long index) {
return _f[index];
}
--------- end code snippets --------
On Linux, all works as expected. When running the servants on Solaris,
the client gets a bunch of 0.0 values, an occassional garbage values
like 42096E-40. Since all functions as expected in straight C++, we
suspect some CORBA issue is at play here, but we haven't been able to
trace it. Does anyone have any ideas?
TIA,
-Armen
--
Armen Yampolsky
Axiom Software Labs
New York