mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2025-10-14 04:28:51 +02:00
fix(memory): fix possible memory leak and add better tests
This commit is contained in:
@@ -17,3 +17,11 @@ type PageContainer struct {
|
||||
func NewContainer(Page *Page, img image.Image, format string, isToBeConverted bool) *PageContainer {
|
||||
return &PageContainer{Page: Page, Image: img, Format: format, IsToBeConverted: isToBeConverted}
|
||||
}
|
||||
|
||||
// Close releases resources held by the PageContainer
|
||||
func (pc *PageContainer) Close() {
|
||||
pc.Image = nil
|
||||
if pc.Page != nil && pc.Page.Contents != nil {
|
||||
pc.Page.Contents.Reset()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user