Skip to content

Commit 1db4450

Browse files
committed
doc: move gc notes from API_CHANGES into CONTRIBUTING
and delete the rest of API_CHANGES
1 parent 0bb0f23 commit 1db4450

File tree

3 files changed

+22
-51
lines changed

3 files changed

+22
-51
lines changed

API_CHANGES.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@
55
This doc is a short introduction on how to modify and maintain the sqlite3-ruby gem.
66

77

8+
## Architecture notes
9+
10+
### Garbage collection
11+
12+
All statements keep pointers back to their respective database connections.
13+
The `@connection` instance variable on the `Statement` handle keeps the database
14+
connection alive. Memory allocated for a statement handler will be freed in
15+
two cases:
16+
17+
1. `#close` is called on the statement
18+
2. The `SQLite3::Database` object gets garbage collected
19+
20+
We can't free the memory for the statement in the garbage collection function
21+
for the statement handler. The reason is because there exists a race
22+
condition. We cannot guarantee the order in which objects will be garbage
23+
collected. So, it is possible that a connection and a statement are up for
24+
garbage collection. If the database connection were to be free'd before the
25+
statement, then boom. Instead we'll be conservative and free unclosed
26+
statements when the connection is terminated.
27+
28+
29+
830
## Building gems
931

1032
As a prerequisite please make sure you have `docker` correctly installed, so that you're able to cross-compile the native gems.

sqlite3.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Gem::Specification.new do |s|
3737

3838
s.files = [
3939
".gemtest",
40-
"API_CHANGES.md",
4140
"CHANGELOG.md",
4241
"CONTRIBUTING.md",
4342
"ChangeLog.cvs",
@@ -72,7 +71,6 @@ Gem::Specification.new do |s|
7271
]
7372

7473
s.extra_rdoc_files = [
75-
"API_CHANGES.md",
7674
"CHANGELOG.md",
7775
"README.md",
7876
"ext/sqlite3/aggregator.c",

0 commit comments

Comments
 (0)