<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git, branch pks/test-allocator</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>tests: only copy when `ptr` is non-NULL</title>
<updated>2023-05-15T10:04:37+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-15T10:04:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=27576416206f696edb16cf2e22271953903e731f'/>
<id>27576416206f696edb16cf2e22271953903e731f</id>
<content type='text'>
Avoid passing a `NULL` ptr to `memcpy` -- that's UB (even if size is 0)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid passing a `NULL` ptr to `memcpy` -- that's UB (even if size is 0)
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: add allocation failure test for buffers</title>
<updated>2023-05-15T08:30:48+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-10-11T09:38:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=8e5281c88b860cce7a6a2f4a00c28b6fb00720b0'/>
<id>8e5281c88b860cce7a6a2f4a00c28b6fb00720b0</id>
<content type='text'>
Test that `git_buf` correctly fails if no more bytes can be allocated.
This is mostly for demonstration purposes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test that `git_buf` correctly fails if no more bytes can be allocated.
This is mostly for demonstration purposes.
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: add allocator with limited number of bytes</title>
<updated>2023-05-15T08:28:47+00:00</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2019-10-11T08:57:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=90cc07711c43b12a4bb270583026cbc71db3823e'/>
<id>90cc07711c43b12a4bb270583026cbc71db3823e</id>
<content type='text'>
In several circumstances, we get bug reports about things that happen in
situations where the environment is quite limited with regards to
available memory. While it's expected that functionality will fail if
memory allocations fail, the assumption is that we should do so in a
controlled way. Most importantly, we do not want to crash hard due to
e.g. accessing NULL pointers.

Naturally, it is quite hard to debug such situations. But since our
addition of pluggable allocators, we are able to implement allocators
that fail in deterministic ways, e.g. after a certain amount of bytes
has been allocated. This commit does exactly that.

To be able to properly keep track of the amount of bytes currently
allocated, allocated pointers contain tracking information. This
tracking information is currently limited to the number of bytes
allocated, so that we can correctly replenish them on calling `free` on
the pointer. In the future, it would be feasible to extend the tracked
information even further, e.g. by adding information about file and line
where the allocation has been performed. As this introduced some
overhead to allocations though, only information essential to limited
allocations is currently tracked.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In several circumstances, we get bug reports about things that happen in
situations where the environment is quite limited with regards to
available memory. While it's expected that functionality will fail if
memory allocations fail, the assumption is that we should do so in a
controlled way. Most importantly, we do not want to crash hard due to
e.g. accessing NULL pointers.

Naturally, it is quite hard to debug such situations. But since our
addition of pluggable allocators, we are able to implement allocators
that fail in deterministic ways, e.g. after a certain amount of bytes
has been allocated. This commit does exactly that.

To be able to properly keep track of the amount of bytes currently
allocated, allocated pointers contain tracking information. This
tracking information is currently limited to the number of bytes
allocated, so that we can correctly replenish them on calling `free` on
the pointer. In the future, it would be feasible to extend the tracked
information even further, e.g. by adding information about file and line
where the allocation has been performed. As this introduced some
overhead to allocations though, only information essential to limited
allocations is currently tracked.
</pre>
</div>
</content>
</entry>
<entry>
<title>alloc: simplify pluggable allocators</title>
<updated>2023-05-14T13:52:15+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-14T13:07:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=9dd1bfe81c3aba6ce35ed85bf62fa75d9c61e1a6'/>
<id>9dd1bfe81c3aba6ce35ed85bf62fa75d9c61e1a6</id>
<content type='text'>
Remove the number of functions that custom allocator users need to
provide; nobody should need to implement `substrdup`. Keep it to the
basics that are actually _needed_ for allocation (malloc, realloc,
free) and reimplement the rest ourselves.

In addition, move the failure check and error setting _out_ of the
custom allocators and into a wrapper so that users don't need to deal
with this. This also allows us to call our allocator (without the
wrapper) early so that it does not try to set an error on failure, which
may be important for bootstrapping.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove the number of functions that custom allocator users need to
provide; nobody should need to implement `substrdup`. Keep it to the
basics that are actually _needed_ for allocation (malloc, realloc,
free) and reimplement the rest ourselves.

In addition, move the failure check and error setting _out_ of the
custom allocators and into a wrapper so that users don't need to deal
with this. This also allows us to call our allocator (without the
wrapper) early so that it does not try to set an error on failure, which
may be important for bootstrapping.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #6535 from libgit2/ethomson/timeouts</title>
<updated>2023-05-13T16:11:56+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-13T16:11:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=9d41a3fd694d983ade53fb602a58f6df25ce0656'/>
<id>9d41a3fd694d983ade53fb602a58f6df25ce0656</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>clone: skip timeout tests on WinHTTP</title>
<updated>2023-05-13T15:42:04+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-04-11T19:59:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=8f695c806bac2b044f102c55b802e44f2d30ca01'/>
<id>8f695c806bac2b044f102c55b802e44f2d30ca01</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>win32: use WSAGetLastError to determine blocking</title>
<updated>2023-05-13T15:42:04+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-04-11T19:55:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=14c820b191a7083bf9a54792e09afcd83e0f0206'/>
<id>14c820b191a7083bf9a54792e09afcd83e0f0206</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>win32: getsockopt takes a `char *` instead of a `void *`</title>
<updated>2023-05-13T15:42:04+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-12T19:48:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=03eebab8a9fc353e96b2f6932d28defd5d868bca'/>
<id>03eebab8a9fc353e96b2f6932d28defd5d868bca</id>
<content type='text'>
Monsters.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Monsters.
</pre>
</div>
</content>
</entry>
<entry>
<title>cmake: use `check_symbol_exists` for rand functions</title>
<updated>2023-05-13T15:42:04+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-12T19:48:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=02ab53ce051df9a6b70b8f075956ed3a41f9979e'/>
<id>02ab53ce051df9a6b70b8f075956ed3a41f9979e</id>
<content type='text'>
`check_symbol_exists` is superior to `check_function_exists`; use it
consistently in our cmake configuration
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`check_symbol_exists` is superior to `check_function_exists`; use it
consistently in our cmake configuration
</pre>
</div>
</content>
</entry>
<entry>
<title>posix: use WSAPoll on win32</title>
<updated>2023-05-13T15:42:04+00:00</updated>
<author>
<name>Edward Thomson</name>
<email>ethomson@edwardthomson.com</email>
</author>
<published>2023-05-12T19:48:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=9908c076ab3fafa18f00c866840819d52bc6b00f'/>
<id>9908c076ab3fafa18f00c866840819d52bc6b00f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
