Displaying 7 results from an estimated 7 matches for "alloc_user_data".
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...ding (name, { args; optargs; ret }) =
List.iter (
function
| OClosure { cbname } ->
- pr " nbd_%s_callback %s_callback = {0};\n" cbname cbname;
+ pr " nbd_%s_callback %s_callback;\n" cbname cbname;
+ pr " struct user_data *%s_user_data = alloc_user_data ();\n" cbname;
pr " if (%sv != Val_int (0)) { /* Some closure */\n" cbname;
pr " /* The function may save a reference to the closure, so we\n";
pr " * must treat it as a possible GC root.\n";
pr " */\n";
-...
2020 Sep 10
1
[libnbd PATCH] python: Fix more memory leaks
...rsistIn (n, _)
| BytesPersistOut (n, _) ->
@@ -279,11 +279,10 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
n;
pr " struct py_aio_buffer *%s_buf;\n" n
| Closure { cbname } ->
- pr " struct user_data *%s_user_data = alloc_user_data ();\n" cbname;
- pr " if (%s_user_data == NULL) goto out;\n" cbname;
+ pr " struct user_data *%s_user_data = NULL;\n" cbname;
+ pr " PyObject *py_%s_fn;\n" cbname;
pr " nbd_%s_callback %s = { .callback = %s_wrapper,\n"...
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
plus adding the 590 asynch test at the end.
Rich.
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...r (
function
| Bool n -> pr " int %s;\n" n
@@ -279,7 +280,7 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
pr " struct py_aio_buffer *%s_buf;\n" n
| Closure { cbname } ->
pr " struct user_data *%s_user_data = alloc_user_data ();\n" cbname;
- pr " if (%s_user_data == NULL) return NULL;\n" cbname;
+ pr " if (%s_user_data == NULL) goto out;\n" cbname;
pr " nbd_%s_callback %s = { .callback = %s_wrapper,\n"
cbname cbname cbname;
pr "...
2020 Sep 08
0
[libnbd PATCH] hack for testing python closure leaks: NOT FOR COMMIT
...%zu'; cat /proc/%%d/cmdline; } > /dev/tty\",\n";
+ pr " alloc_count, getpid ());\n";
+ pr " system (cmd);\n";
+ pr " free (cmd);\n";
+ pr "}\n";
+ pr "\n";
pr "static struct user_data *\n";
pr "alloc_user_data (void)\n";
pr "{\n";
+ pr " static bool init;\n";
+ pr " if (!init) {\n";
+ pr " init = true;\n";
+ pr " atexit (dump_alloc_count);\n";
+ pr " }\n";
+ pr " alloc_count++;\n";
pr " struct user_data...