I've made a struct Variant as...

struct VARIANT
{
    VARTYPE vt;
    union {
    Int32  *int32Val;
    UInt8  *byteVal;
    Char   *stringVal;
   };
};
typedef struct VARIANT Variant;


Inside a Function I am using it like this....

 Variant *varPtr = NULL;
 varPtr = (Variant *)MemPtrNew(sizeof(Variant)); //Memory allocation
successfull
 varPtr->int32Val = MemPtrNew(sizeof(Int32)); //Here it gives an ERROR
stating: tyring to write to an unallocated chunk !!

 MemSet(varPtr->int32Val,4,0);    // it doesnt comes to this line at all
 *varPtr->int32Val = 5;


Similar Allocation has worked fine many times above this code successfully
Some times .. it takes this line without error but gives in similar lines
afterwards..
I am not able to track this error,
I'vnt done much memory operations so far as to eat up whole mem available
only thing .. i have many library globals in my library , using this code ..
does it cause any problem?
Any idea?? whatz wrong with this only at this line ..
thanx in advance,
Dinesh.


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

Reply via email to