Thread: Dynamic Allocation

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    7

    Dynamic Allocation

    I know that this is not a forum that explicitly does assembly, but I was directed here from another forum and I was wondering if anyone could help.

    My orginal post was:
    Is there a way to dynamically allocate memory in the data segment? If so, how?
    Someone then suggested to create a memory manager. Does anyone have resources (websites, papers, books, code, etc.) to implement such a thing?

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    For future reference, flashdaddee.com has an assembly forum.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    7
    Thank you so much!

    The one that I have been visiting is not that active.

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    70
    But man....I can't understand why do you want to allocate memory dynamically from data segment. Because data segment is reserved only for a program. No other programs are allowed to used the memory reserved for another one program.

    Please let me know.......
    Chintan R Naik

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    7
    This is part of a project that I am doing (on my own, crazy as that sounds ) The user is to input a string, and using some parsing techniques, I will generate an array (list, vector, whatever) of tokens. I am attempting to do this all in assembler.

    The problem is that I have no way of knowing how many tokens that I have received until I tokenize it. Furthermore, this array can grow throughout the process. So my thinking on it is that I could split the string up on the fly and use some sort of memory manager to hold the information. When I mean allocating memory, I mean just somehow have a way in which I could mark out sections of the segment to hold data.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Parse the string, get the token count, create the array, fill the array.

    You could use the stack to do this dynamically.

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    7
    However, when you create the array, you need to block out some memory. That's where the dynamic allocation comes in.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dynamic allocation from 1 instead of zero
    By cfdprogrammer in forum C Programming
    Replies: 27
    Last Post: 04-28-2009, 08:21 AM
  2. pointer to array with dynamic allocation
    By cfdprogrammer in forum C Programming
    Replies: 22
    Last Post: 04-07-2009, 09:56 AM
  3. Difference between straight and dynamic allocation?
    By darsunt in forum C++ Programming
    Replies: 10
    Last Post: 06-04-2008, 05:47 PM
  4. Dynamic memory allocation.
    By HAssan in forum C Programming
    Replies: 3
    Last Post: 09-07-2006, 05:04 PM
  5. Dynamic allocation (I thought it would crash)
    By Baaaah! in forum C Programming
    Replies: 16
    Last Post: 11-30-2005, 05:10 PM