At 03:12 AM 11/5/2003, Vytautas Leonavicius wrote:
Hello,

Well, MemPtrNew allocates a maximum of ~64Kb. But when I allocate
std::vector on the stack, I got bad_alloc if I try to allocate more than
~30Kb. But if I use new on vector, that is:

The stack on Palm OS apps is limited to around 4K.


VecP p = new Vec[64k] it works, when allocating in this way - Vec v =
Vec[64k]. Why?

The vector implementation in MSL doesn't allocate memory until an element has been modified or accessed. This is for efficiency -- you can create a vector and if you don't use it, you don't have the allocation overhead.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to