Questions on Allocating blocks of memory
I have been working with several classes that copy various data structures into and out of blocks of memory to be able to pass them to various API calls.
I got an idea for a new class that I think would work better if the data was actually stored in a block of memory. Not having used the Memory Allocation routines much myself, I don't know which routines would be best to use.
I thought of doing the usual, and setting up a UDT to hold the data; but the data can be of different sizes for each instance of the object. Also several of the UDT elements have allignment issues, so VB fills in with extra bytes that will make many of the methods much more complex having to compinsate for the extra bytes. Calling API routines, and storing the data suffer the most from these allignment issues.
I thought for this class that the data could be in a single block of memory and therefore avoid the allignment and dynamic size issues.
So my questions are:
Which routines would be best? (Global, Local, Heap, Vitural, File Mapped?)
Would I need to use the memory Lock and Unlock routines, and if so when do I need to lock memory and when should I unlock it?
What clean up do I need to do when the object is terminated?
Last Post: 11-16-2007, 12:23 PM
By jackis in forum The Lounge
Last Post: 01-06-2006, 07:58 PM
By Mark Alexander Bertenshaw in forum VB Classic
Last Post: 03-04-2002, 07:04 AM
Last Post: 11-02-2001, 04:22 PM
Last Post: 05-12-2001, 02:00 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL