[DGD]string reference/swapout problems

Felix A. Croes felix at dworkin.nl
Sat Mar 6 17:35:52 CET 1999


Marc Spoorendonk <marc at freud.et.tudelft.nl> wrote:

>[...]
> > > My question is: Is there a way to prevent the string from being swapped
> > > out?
> > 
> > You can prevent swapping altogether in the config file by setting both
> > swap_fragment and static_chunk to 0, and masking swapout() in the
> > auto object.  That is the only way to prevent LPC datatypes, such as
> > strings, from being swapped out.
>
> That has ofcourse nothing to do with my problem. Swapping is cool, I don't
> want to shut it off. The question is: Can i store a string in the driver
> by reference. Or do i always need to copy it due to swapout problems
> otherwise? 

I thought that was the question that I answered, but I'll try to
rephrase what I wrote:

No.

Strings are <meant> to be swapped out.  If you want to allocate
something permanently, you should use "static" memory allocation:

    m_static();
    pointer_to_thing = ALLOC(type_of_thing, number_of_things);
    m_dynamic();

"thing" should not be a string, an array or a mapping however.

Regards,
Dworkin

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list