# default is 50 MB
SALOME_BIG_OBJ_ON_DISK_THRES_DFT = 50000000
+DicoForProxyFile = { }
+
from ctypes import c_int
TypeCounter = c_int
f.write( obj )
def IncrRefInFile(fname):
+ if fname in DicoForProxyFile:
+ DicoForProxyFile[fname] += 1
+ else:
+ DicoForProxyFile[fname] = 2
pass
- """with open(fname,"rb") as f:
+
+def IncrRefInFileOld(fname):
+ with open(fname,"rb") as f:
cntb = f.read( GetSizeOfTCnt() )
cnt = TypeCounter.from_buffer_copy( cntb ).value
with open(fname,"rb+") as f:
#import KernelServices ; KernelServices.EntryForDebuggerBreakPoint()
- f.write( bytes( TypeCounter(cnt+1) ) )"""
+ f.write( bytes( TypeCounter(cnt+1) ) )
def DecrRefInFile(fname):
+ if fname not in DicoForProxyFile:
+ cnt = 1
+ else:
+ cnt = DicoForProxyFile[fname]
+ DicoForProxyFile[fname] -= 1
+ if cnt == 1:
+ del DicoForProxyFile[fname]
+ if cnt == 1:
+ if os.path.exists(fname):
+ os.unlink( fname )
pass
- """import os
+
+def DecrRefInFileOld(fname):
+ import os
with open(fname,"rb") as f:
cntb = f.read( GetSizeOfTCnt() )
cnt = TypeCounter.from_buffer_copy( cntb ).value
os.unlink( fname )
else:
with open(fname,"rb+") as f:
- f.write( bytes( TypeCounter(cnt-1) ) )"""
+ f.write( bytes( TypeCounter(cnt-1) ) )
def GetBigObjectOnDiskThreshold():
import os