This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can i do this?

hi, n e bod know how i can refrag the data in memory?

thx

ow btw, i have the 51 compiler.

Parents
  • You don't need to "refragment" a block of memory, just to send the contents in smaller parts.

    Just set a pointer to the start of the big block. Process n bytes. Step pointer forward n bytes. Process n bytes. Step pointer forward n bytes. Repeat until done. Note that the last processed block may have less than n bytes if your big memory block isn't an even multiple of the transfer size.

    Only one thing to notice: If your program is allowed to change the contents of the large block during the transfer, then you will not be able to send a "snapshot" contents of the large block. On the other hand - the only possible way to send a snapshot is to forbid updates to the large block while the transfer is active, having enough memory to duplicate the block before you start the transfer or keeping a "change list" and dynamically patch outgoing messages based on previous contents stored in the change list.

Reply
  • You don't need to "refragment" a block of memory, just to send the contents in smaller parts.

    Just set a pointer to the start of the big block. Process n bytes. Step pointer forward n bytes. Process n bytes. Step pointer forward n bytes. Repeat until done. Note that the last processed block may have less than n bytes if your big memory block isn't an even multiple of the transfer size.

    Only one thing to notice: If your program is allowed to change the contents of the large block during the transfer, then you will not be able to send a "snapshot" contents of the large block. On the other hand - the only possible way to send a snapshot is to forbid updates to the large block while the transfer is active, having enough memory to duplicate the block before you start the transfer or keeping a "change list" and dynamically patch outgoing messages based on previous contents stored in the change list.

Children
No data