You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2024. It is now read-only.
Within temp_memory_handle class, can we avoid completely free the object when invoking each type of *_malloc() function? I thought, by design if needed, users/developers should be able to allocate memory multiple times using the same set of env_fns or handle object, like:
{
temp_memory_handle scratch_space(env_fns);
ptr = scratch_space.device_malloc();
/* do something */
ptr = scratch_space.device_malloc(); // calling free_memory() before malloc_fn()/* do something */
}
However, free_memory() function serves as the destructor of the entire handle object, for example, here:
it not only frees the memory but also deletes memory context. Thus, the above code snippet would crash with segfault from calling *malloc_fn function (memory_context_ becomes nullptr after each free_memory call).
Therefore, I suggest to add a new free_data function to just deallcoate memory but not memory context, before each *_malloc() call.