Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: custom size for engine structs [Re: Uhrwerk] #408709
10/05/12 21:50
10/05/12 21:50
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline OP
Expert
MasterQ32  Offline OP
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Originally Posted By: Uhrwerk
My point was that if the memory footprint of engine objects would be random ptr_remove wouldn't be able to free them because it had no idea how large the area to be released was.

Why should this happen?
neither ptr_remove nor sys_free nor free need to know how large the memory block was...
where should those functions know it anyways?
so this would be no problem


Visit my site: www.masterq32.de
Re: custom size for engine structs [Re: Uhrwerk] #409318
10/15/12 15:19
10/15/12 15:19
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Originally Posted By: Uhrwerk


My point was that if the memory footprint of engine objects would be random ptr_remove wouldn't be able to free them because it had no idea how large the area to be released was.


No thats wrong, even the most basic memorymanagement works like this:

struct MemBlock{
uint Mem_StartAdress
uint Mem_Length
}MemBlock;

The returned pointer has the adress inside the evaluated StartAdress, and memoryallocation is a list of those blocks. and when you free memory, you search for the memblock with the given startadress. You dont need to know the length of the memory you reserved, because the MManagement takes care of it.


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: custom size for engine structs [Re: Rackscha] #409320
10/15/12 15:33
10/15/12 15:33
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
MasterQ32: I can understand that you want to add data areas to engine objects, but why don't you define your own structs for that? Such a struct would contain a pointer to the allocated engine object, plus your additional data area, and use its own create and remove function. That's the normal way to solve this in C.

Page 3 of 3 1 2 3

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | 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