it is my fault.

I have read msdn again,copy the remarks 

The size argument gives the new size of the block, in bytes. The contents 
of the block are unchanged up to the shorter of the new and old sizes, 
although the new block can be in a different location. Because the new 
block can be in a new memory location, the pointer returned by realloc is 
not guaranteed to be the pointer passed through the memblock argument.

that is sure the size is not limition.

thank a lot.





"Cory Nelson" <[EMAIL PROTECTED]> 
2007-07-12 16:00
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: [sqlite] realloc size smaller than malloc size?is it error in vc6?






On 7/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> in the os_common.h file there are
> 
sqlite3GenericMalloc,sqlite3GenericRealloc,sqlite3GenericFree,sqlite3GenericAllocationSize
> function.
> If I run the sqlite in windows,the sqlite3GenericRealloc function just
> call the realloc function.
> from the msdn and my test,the realloc(void *p, n)function,the realloc 
size
> must equel or bigger than the malloc size, or it will be corrupt.
>
> But when I trace the sqlite3_3_17, I find the realloc size sometimes can
> smaller than the original malloc size for the same memory pointer,I 
think
> this should be error.

realloc does not require size to be larger than the last alloc size.
if msdn says otherwise it is mistaken.  vc++ implements it correctly.

> But I still can get the right result by running the simple.
> Is it a problem?
>
> anybody trace the realloc function?
>
> Thanks in advance.
>
> BR
> allen.zhang
>
>
>
>
>


-- 
Cory Nelson

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to