Here I allocated memory of 1 MB.And in my application my data is 512 bytes blocks....So I've to check some conditions if that satisfies then that data block must copy to buffer.And when the buffer fills full(1 mb totally used ) I will copy that to another buffer and frees the Allocated buffer1.
I wanna append small small data blocks to the buffer of 1 mb. How can I do this..Is it possible with VirtualAlloc( ) ......?
Assume data size =512 bytes
while( some coditions)
{
if( buffer1 is not fully used)
{
copy 512 bytes data to buffer1
}
else
{
LPVOID buffer2 = VirtualAlloc(NULL, 1048576 ,MEM_COMMIT,PAGE_READWRITE); // 1048576 = 1MB
//copy to buffer2
//Not actually copy..Append my small buffer to another buffer
buffer2=buffer1; //Not correct. append is possible with buffer?
VirtualFree(buffer1);
}
}
Edited by krishnampkkm, 11 June 2009 - 10:37 PM.


Sign In
Create Account

Back to top









