Skip to content

Commit 8ac51b3

Browse files
authored
RFC: Disable precompilation to avoid memory spike (#38)
* Disable precompilation to avoid memory spike * Make __precompile__(false) optional * Bump version to 0.3.7
1 parent 2a2a4b3 commit 8ac51b3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CompactBases"
22
uuid = "2c0377a8-7469-4ebd-be0f-82e501f20078"
33
authors = ["Stefanos Carlström <[email protected]>"]
4-
version = "0.3.6"
4+
version = "0.3.7"
55

66
[deps]
77
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"

src/CompactBases.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
module CompactBases
2+
# The package does support precompilation, but doing `using CompactBases` with
3+
# precompilation on can lead to a huge spike in memory. That does not happen if disable
4+
# precompilation for CompactBases with __precompile__(false).
5+
#
6+
# So, if this is a problem for the user, it is possible to disable precompilation by setting
7+
# the COMPACTBASES_NO_PRECOMPILE environment variable. E.g. the user can set it when
8+
# launching Julia by doing
9+
#
10+
# COMPACTBASES_NO_PRECOMPILE= julia
11+
#
12+
# or set it in the ~/.julia/config/startup.jl file by setting
13+
#
14+
# ENV["COMPACTBASES_NO_PRECOMPILE"] = ""
15+
#
16+
# Note that any value will do, even an empty string, as only the presence of the variable is
17+
# checked.
18+
haskey(ENV, "COMPACTBASES_NO_PRECOMPILE") && __precompile__(false)
219

320
import Base: eltype, axes, size, ==, getindex, checkbounds, copyto!, similar, show, step
421
import Base.Broadcast: materialize

0 commit comments

Comments
 (0)