So, I suppose that there is no arm de-allocating a table before reallocating it with a negative number.
Somehow, most of the memory problems of my synth are gone now that I am de-allocating the tables before recreating them. ( Or maybe this is a belief and it does not do anything)
instr LoadSoundFile ; load sound file
SFilePath strcpy p5
if filevalid(SFilePath) ==1 then
gitableOscA ftgen -901,0,0,1,SFilePath,0,0,0 ; deallocate table first with negative number
gitableOscA ftgen 901,0,0,1,SFilePath,0,0,0 ; load sound file into a GEN 01 function table
gichansOscA filenchnls SFilePath ; derive the number of channels (mono=1,stereo=2) in the sound file
giReadyOscA = 1 ; if no string has yet been loaded giReady will be zero
gkTabLenOscA init ftlen(gitableOscA)/gichansOscA ; table length in sample frames
Smessage sprintfk "file(%s)", SFilePath ; print sound file to viewer
prints Smessage
chnset Smessage, "filerOscA"
else
printks "File no valid \n",0
endif
endin