Skip to content

memset / allocation #116

@parnet

Description

@parnet

memset and other allocation should be thought about as pointed out in the VariableArray1 class

value_type *new_values = new T[newN];
directly throws an error and does not return nullptr as the code suggests
could replaced with new (std::nothrow) value_type[newN]();

memset(reinterpret_cast<void *> (new_values), 0, sizeof(T)*newN);
could be replaced with std::fill(val,val+N,T{})

memset is only safe for trivial types like double, int and plain structs but not for objects that might need a constructor. The value_type of the template could be restricted to guarantee or std::fill could be used to construct types into the memory

to adapt for gpu this might need to replace with a malloc function of the library to use pinned memory and improve transfer rates to device.
memory should be aligned to improve general access rates of memory

this of course should be considered to all other crucial allocations of memory within different datastructure (t.ex. geometry container osv. )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions