Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ent_cloneskin issues with 7.66 (same as ent_clone issue) #248517
01/27/09 11:53
01/27/09 11:53
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I found the problem with ent_clone() on the bugs page,
but it doesnt mention ent_cloneskin().

Im getting exactly the same symptoms with 7.66 using
ent_cloneskin(). The same workaround as that listed
for ent_clone() ALSO works-around the ent_cloneskin issue.

Just bringing this to your attention in case it is NOT a
linked issue.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: EvilSOB] #248647
01/28/09 09:22
01/28/09 09:22
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Yes, it's the same.

Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: jcl] #249328
02/01/09 19:23
02/01/09 19:23
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Cool, thanks.

Also, this may also be related, or I can start a new thread if you want.
When using ent_clone, how do you release the memory it consumes? I can get neither ent_remove, ptr_remove,
nor ent_purge to give me the memory back.
AND, if I run ent_clone on an entity MORE than once, it seems to be re-cloning because it consumes another chunk of
memory each time.

(By memory I mean nexus size. And in my test model it uses about 550k each time I use ent_clone from a 1meg MDL,
containing 100 verts, just in case that information is of use to you)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: EvilSOB] #249373
02/02/09 07:27
02/02/09 07:27
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Of course ent_clone consumes memory. Doubling the model in memory is the very purpose of ent_clone - or for what other reason are you using it?

A cloned model is a precise copy of the original model, and everything, behavior, memory releasing and so on, is precisely the same. The engine does not know the difference between a cloned and original entity.

Imagine you have just copied the model file under a different name, and used the copy for the entity - this is the same as cloning.

Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: jcl] #249388
02/02/09 09:40
02/02/09 09:40
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
You mis-understand my questions. I will try phrasing them differently.

QUESTION>1
Once I have sucessfully cloned an entity, used it for my nefarious purposes, and no-longer need it
(as in a destroyed artifact), i would expect using ent_remove, ptr_remove, or ent_purge would release
all of the resources the entity was consuming.
But it doesnt... All the nexus it was using is still in use.

I know this because in my project (which is too large and scattered to post), I do basically this...
Step 1> ent_create(same model every time)
Step 2> clone_ent
Step 3> modify its mesh
Step 4> leave it visible a while
Step 5> ent_purge & ent_remove
This process occurs with up to 50 entities at any one time, and the problem is my memory consumption
(ie nexus) and as shown in WindowsTaskManager/Processes just keeps growing by 500k per entity created.
BUT if I kill ONLY Step2 (ent_clone), all ents look the same now, but my memory consumption STOPS growing.
So in my mind that tells me the cloned entity is not being released from memory by ent_purge or ent_remove.
See what my problem is, and why I think its ent_clone?
PS If Im not using the correct way to purge the memory of the ent_clone, I apologise and please explain.


QUESTION>2
My second question was why does ent_clone consume space when used on the same entity more
than one time. Only the most recent clone will be valid (and accessable), so isnt any of the intermediate
clones of this entity a waste of resources? It would be a programming flaw to allow this to happen in
one's code, but shouldnt the engine try to protect against certain types of programmer mistakes?


Example
ENTITY* test = ent_create("MyModel.mdl",...); //creates "MyModel.mdl" at address #1
ent_clone(test); //creates a clone "MyModel.mdl" at address #2
ent_clone(test); //creates a another clone "MyModel.mdl" at address #3
ent_clone(test); //creates a another clone "MyModel.mdl" at address #4
ENTITY* test2 = ent_create("MyModel.mdl",...); //I assume this points to the "MyModel.mdl" at address #1 (please correct if wrong assumption)

Isnt the existance of the clones at addresses #2 and #3 a waste of space? And if I then say
ent_purge(test); and ent_remove(test); then which model at which address (if any) get free'ed?

Wouldnt it be "better" if the enging took away this chance of dumb programmer errors by working like this instead?

Example
ENTITY* test = ent_create("MyModel.mdl",...); //creates "MyModel.mdl" at address #1
ent_clone(test); //creates a clone "MyModel.mdl" at address #2
ent_clone(test); //does nothing as 'test' is already a clone, and is thereby unique
ent_clone(test); //still does nothing as 'test' is already a clone, and is thereby unique
ENTITY* test2 = ent_create("MyModel.mdl",...); //I assume this points to the "MyModel.mdl" at address #1 (please correct if wrong assumption)



Thanks for your time.
And again, I'll make this the first post of a new thread either here in Bugs, or in Ask-Developers
forum if you want.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: EvilSOB] #249392
02/02/09 09:56
02/02/09 09:56
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
For freeing nexus that you allocated at a certain point, you can use the level_mark and level_free functions.

As to your second question: No, that's not the way programming normally works. When you allocate memory by creating a new model, the computer does not care if you really need that model. The commands are just executed, whether they make sense or not.

Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: jcl] #249400
02/02/09 11:44
02/02/09 11:44
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
As for the second question - OK, I can live with that. It was just a "it would be nice if" type question.

And for the first question, I cant see any way to implement level_free in my situation.
So there is no definately other way to free a selected entity's nexus usage other than level free?
Because my entities are elements of a self-creating, flowing landscape, created in an empty level. So I cant use
level_free to remove old entity-space because I now have new, living entities that have been created since
my last proposed level_mark.

Any ideas or suggestions? (yes this is stretching the topic a lot)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: EvilSOB] #249405
02/02/09 11:55
02/02/09 11:55
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
If you need the models only temporarily, why don't you re-use models, instead of cloning them anew? This would be much faster anyway.

Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: jcl] #249410
02/02/09 12:17
02/02/09 12:17
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I think Im going to have to, but to do that I'll need to make an array of entities,
which will have a fixed number of elements at design time.

Whereas the code I've developed so far (with much blood, sweat and many tears)
is theoretically limitless, using a custom linked list of structures that store
the entity of that location as well as much other data. (I'd only just started
testing the memory consumption when this clone issue became instantly apparent)

So it was self-adjusting in size, dependant on available CPU horsepower at run-time,
and now it is going to have to be decided at compile-time instead.

I think I'll look into creating meshes in realtime using directX first though,
I want my project to be very PC-Hardware tolerant.

This is not an actual request, but how feasable would it be, in your opinion,
to request an ent_purge like new function (or appended to ent_purge) that
will release the model-data memory(that ent_clone creates).
Thereby alleviating my problem as well as having a useful memory management
tool being added to the engine....


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: ent_cloneskin issues with 7.66 (same as ent_clone issue) [Re: EvilSOB] #249525
02/03/09 05:36
02/03/09 05:36
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
An array needs not have a fixed number, you can use malloc and mfree for allocating any number at runtime.

Page 1 of 2 1 2

Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1