Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reallocating Memory

Status
Not open for further replies.

Glenn9999

Programmer
Jun 19, 2004
2,312
US
Has anyone done any project where they reallocated memory with a specific pointer? I'm trying to do that and it seems to not be supported? Any ideas anyone has on this will be welcome.

Measurement is not management.
 
Glenn, can you be more specific (where do you want to use it)?

reallocating memory is offcourse supported. But it *can* fail. In fact the VCL uses reallocation whole the time.
what API do you want use (or are you using)? Beware this is a tricky subject...

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Glenn, can you be more specific (where do you want to use it)?

I'm trying to alter some untyped memory. I figured out that I couldn't use getmem/freemem in that case. Of course, if the memory size gets larger, then I still have to reallocate a larger block. But the problem still seems that I keep getting back the same block of memory no matter what I do, which is causing problems with getting my code that's doing the alterations correct.

So I'm wondering if there's any good solution out there for this one before I end up writing my own memory manager to accomodate this function.

Measurement is not management.
 
But the problem still seems that I keep getting back the same block of memory

that could happen with realloc. due to fragmentation.
-> show me code
what delphi version are you using?
No need to write a new memory manager, FastMM4 should meet all your needs.

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
I got it solved. Thanks.

Measurement is not management.
 
you want to share the solution?

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
It was a logic error specific to the code I was working on, involving a misplaced pointer address.

Measurement is not management.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top