Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func NewApp(cfg *config.Config, options ...Option) (*App, error) {
var engine *rules.Engine
var rs *config.RulesCompileResult

signature.InitStore()
fs.InitMetadataStore()

if cfg.Filters.Rules.Enabled && !cfg.ForwardMode && !cfg.IsCaptureSet() && !cfg.IsFilamentSet() {
engine = rules.NewEngine(psnap, cfg)
var err error
Expand Down
6 changes: 6 additions & 0 deletions pkg/fs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ func GetMetadataStore() *FileMetadataStore {
return metadataStore
}

func InitMetadataStore() {
onceMetadataStore.Do(func() {
metadataStore = newFileMetadataStore()
})
}

// FileMetadataStore contains metainfo of PE files derived
// from file creation or DLL loading. Metadata store is
// invalidated on various signals such as file overwriting
Expand Down
7 changes: 7 additions & 0 deletions pkg/util/signature/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ func GetSignatures() *Signatures {
return sigs
}

// InitStore eagerly initializes the signature store and its worker pool.
func InitStore() {
once.Do(func() {
sigs = newSignatures()
})
}

func newSignatures() *Signatures {
sigs = &Signatures{
signatures: make(map[Key]*Signature, 512),
Expand Down
Loading