[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Some memory reallocation.



there are many options. 

you cold write an Allocator Object.. which is pretty complex.

For a patch, you could work on these notes.
Allocate 20 bytes. (say)
Data returned is 4 bytes. (much less than 20)
Frshly Allocate 4 bytes from the heap.. now taht you know your returned data
size !
Copy the data into these newly allocated 4 bytes.
Destroy / Deallocate the original heap of 20 bytes.

Slightly inefficient, but very simple.

Regards,
Shourya

_______________________________________________
Shourya Sarcar || Global Software Platforms
gemedicalsystems.com || ge.com || elfun.org
5263121 xt 362 || shourya@xxxxxxxxxxx




~-----Original Message-----
~From: Ketan Mehta [mailto:ketan.mehta@xxxxxxxxx]
~Sent: Thursday, December 07, 2000 5:09 PM
~To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx;
~nitant.kulkarni@xxxxxxxxx
~Subject: [LIP] Some memory reallocation.
~
~
~Hi all,
~	I have a situation where I have allocated a memory 
~chunk to request
~some data. Ultimately, I end up getting much lesser data than I had
~requested for. Now I want to just retain the got data and free the
~unused chunk from my earlier allocated chunk. How do I go about doing
~this?
~	Any pointer or suggestion are welcome.
~	TIA
~bye
~ketan
~
~-- 
~|------------------------------------------------------------|
~|It is better to keep your mouth shut and be thought a fool, |
~|            than to open it and remove all doubt.	     |
~|------------------------------------------------------------|
~|Ketan Mehta | Wipro | Bangalore | Ph 91-80-5722296/93-5240  |
~|ketan.mehta@xxxxxxxxx | ketan_kmehta@xxxxxxxxxxxx (personal)|
~|------------------------------------------------------------|
~
~---------------------------------------------
~Find out more about this and other Linux India
~mailing lists at http://lists.linux-india.org/
~