giwo wrote:The first time an object is used, we allocate a JSObject for it, this is why memory usage increases. I was only testing wipe, so on my tests it recovered the memory it used (as the JSObjects were deleted). However, on a normal IterateOver() call, we allocate those JSObjects (unless one has already been allocated for the object) and don't free them until the object itself is deleted.
Sounds logical .
giwo wrote:I am considering a way to release those JSObjects after a while of non-use, but alternatively since it is only the IterateOver() function that would every cause so many allocations, we can de-allocate the JSObjects it created immediately after execution. Downside would be more time spent to Re-allocate those JSObjects next time (try running a cleanup again and notice how quick it runs), upside is faster recovery of that memory (which will be quite a large chunk on a big server).
I wouldn't consider cleanup a time-critical operation, so I would rather regain that memory than having it run faster. Maybe some type of smart caching would be nice. If an object is called often or in regular intervals keep it allocated if not de-allocate it after it has been used.
Tested the aforementioned thought, and seems to do quite well on memory recovery, definately slows down the JS IterateOver() function (which I don't consider to be all too important, as searching through every item or character in the world is something you won't be doing often).
[color=yellow]UOX3 Code[/color]
Updated bitmask setting/getting code for CChar, making it a bit more friendly and less error prone
[color=yellow]UOX3 DFNs[/color]
Fixed a bug with rugs_carpets.dfn where a closing bracket was missing for object 0x1e41
[color=yellow]PkgInstaller[/color]
Updated to include a Package class, to help abstract it more, and help with future processing of multiple packages
[color=yellow]ToolAPI[/color]
Added SpawnRegion.cs, DefinitionCollection.cs, and DefinitionTree.cs
Updated TownRegion parsing code so that it parsees a WorldSection and a ScriptSection separately
DefinitionContainer = all the definitions dealing with a particular category of DFN
DefinitionTree = one DefinitionContainer per DFN Cat collection
eg code for DefinitionTree
UOXData.Script.DefinitionTree dfnTree = new UOXData.Script.DefinitionTree( dfnPath );
UOXData.Script.ScriptSection mSect = dfnTree.FindEntry( "RACE 1", UOXData.Script.DFN_Categories.race );
if( mSect != null )
System.Windows.Forms.MessageBox.Show( "Hooray! Race found" );
[color=yellow]2/24/2006 - giwo (0.98-3.4l [3.5 BETA])[/color]
Modified OnIterate() to de-allocate any JSObject it uses to free wasted memory.
Merged all boolean values in cServerData to a single UI32 using bitmasking.
[color=yellow]2/25/2006 - Xuri[/color]
Replaced HP tag with HPMAX for all appropriate NPCs
Updated TOPROV, TOPEACE and TOTAME tags for all NPCs
Added TAMEDHUNGER and FOOD tags to all appropriate NPCs
Added Squirrel and Ferret NPCs to animals.dfn, and added them to the NPC addmenu
Fixed a misspelled skillname for a gargoyle NPC
[color=yellow]2/25/2006 - grimson (0.98-3.4m [3.5 BETA])[/color]
Changed the default of totame to 0x7FFF and allowed taming of NPCs with a value of 0.
Changed DFN tags MANA and STAMINA so you can set a minimum and maximum value.
Added new DFN tags:
MANAMAX, STAMINAMAX They work equal to the HPMAX tag.
TOPROV, TOPEACE They set the minimum skill amount to provocate or peace a NPC.
Added new JS propertys:
.skillToProv Can be used to get/set the amount of skill needed to provocate a NPC.
.skillToPeace Can be used to get/set the amount of skill needed to peace a NPC.
changed JS propertys:
.maxstamina and . maxmana now work equal to the .maxhp property.
Added the new JS propertys to the set command.
@Xuri
TOPROV and TOPEACE actually didn't exist at all in the code, so I added them, but you'll have to actually make use of them in the JS files for the skills.
[color=yellow]2/25/2006 - grimson[/color]
Fixed a bug that allowed health regeneration while the char was starving.
Moved the bools for the fixed maxHP, maxMana, maxStamina into a bitmask.
[color=yellow]2/25/2006 - Xuri[/color]
Added skillcheck to peacemaking, checks against target NPC's .skillToPeace property
Modified provocation to check bard's skill against the value of provoked NPC's .skillToProv property
Added id 0x122a with DECAY=1 to harditems.dfn, so blood puddles added when carving corpses actually decay.
[color=yellow]2/25/2006 - grimson (0.98-3.4n [3.5 BETA])[/color]
Changed CChar::WearItem() to not fire the onEquip event on world loads.
Modified the TOPEACE tag so it can take a second value that sets the chance gain to recover
from peacemaking upon hits.
Modified cMagic::MagicDamage() and CHandleCombat::HandleCombat() to recover from peacemaking
by calculating a chance using the chance gain set on TOPEACE and the number of hits.
Added two new JS propertys for chars:
.canAttack Set this to 0 to prevent a char from attacking.
.brkPeaceChance Gets and Sets the chance gain to recover from peacemaking.
Modified the .skillToProv and .skillToPeace propertys so they return the value of the corresponding
skill for player chars.
[color=yellow]2/25/2006 - grimson[/color]
Changed CHandleCombat::HandleNPCSpellAttack() to prevent NPCs from using spells when they
are not allowed to attack.
Changed cMagic::SelectSpell() to prevent PCs from using spells when they are not allowed
to attack. Note: This doesn't effect JS implemented spells, use the .canAttack property
in them to prevent the use of these spells.
Output a sysmessage to PCs informing them that they can not attack. (updated Dictionaries)
[color=yellow]2/25/2006 - grimson (0.98-3.4o [3.5 BETA])[/color]
Added another new JS property for chars:
.setPeace=# This handle the whole peacemaking effect, it will stop the char from attacking
and prevent him from attacking again until the given time is over or he got
enough damage.
Updated the peacemaking.js to use the new property and to prevent peacemaking from affecting the
char using it.
Output a sysmessage to PCs informing them of the end of the peace effect. (Dictionarys again)
[color=yellow]2/26/2006 - grimson[/color]
Added a line of sight check to the isValidAttackTarget() function in ai.cpp so NPCs won't attack
targets they can not see.
[color=yellow]2/25/2006 - giwo (0.98-3.4p [3.5 BETA])[/color]
Added some example usages of ClilocMessage().
Added support for packet 0xC1, sending cliloc messages.
Added two ClilocMessage() functions, one for direct-to-socket (system) messages, and one
for object-speech (to a socket or to all sockets in range).
[color=yellow]2/26/2006 - grimson[/color]
Modified cCharStuff::addRandomLoot() so that loot lists can contain links to other loot lists.
DFN changes:
Changed the the numbers in the LOOT tags of NPCs to random lootlist entrys.
Fixed some GET tags in the armor dfns that were pointing to non existant items.
[color=yellow]2/26/2006 - giwo (0.98-3.4q [3.5 BETA])[/color]
Fixed some areas that could possibly cause MapRegion corruption.
Fixed a VC 2005 Compiler warning.
Defaulted CreateItem() to set decayable to true.
[color=yellow]2/26/2006 - grimson[/color]
Added functions IsStaticSurface() and IsTileSurface() to mapstuff.cpp and use them in
CanMonsterMoveHere() to prevent spawnregions from spawning NPCs in places where they
can not move or shouldn't be able to move to, like display cases.
[color=yellow]27th February, 2006 - Maarc[/color]
Updated code that uses |= and &= to use MFLAGSET and MFLAGGET instead, promoting them to a higher public level. Down to only a very few number of references like that now
Updated the race code because it was getting out of sync with the WeatherTypes. The two were bound together in a number of ways, and it's now more generic and tied closer
[color=yellow]2/28/2006 - grimson (0.98-3.4r [3.5 BETA])[/color]
Replaced the WATERCREATURE tag from creatures.npc with a new tag:
MOVEMENT=WATER for creatures that can only move in water.
MOVEMENT=LAND for creatures that can only move on land.
MOVEMENT=BOTH for creatures that can move on land and in water.
Added calc_WaterWalk() function to movement.cpp and changed the calc_move() function so that
it uses it for water creatures and amphibians.
Added IsStaticWet() and CanSeaMonsterMoveHere() functions to mapstuff.cpp.
Added FindCharSpotToSpawn() to cSpawnRegion.cpp and use it when spawning NPCs, renamed
FindSpotToSpawn() to FindItemSpotToSpawn() and use it when spawning items.
DFN changes:
Updated creatures.dfn to use the new MOVEMENT tag.
Updated tiles.dfn to set a water tile to wet that was missing that flag.