Jump to content
Ian Branch

Get memory used by a Memtable record??

Recommended Posts

Hi Team,

D11.

I am playing with TFDMemTable.

I have the following line of code...

FDMemTable1.CopyDataSet(Company, [coStructure, coAppend]);

Company is previously filtered so there is only one record 'visible'.

How can I tell how much memory has been used as a result of just this code/action please?

Regards & TIA,

Ian

Share this post


Link to post

I had the same question a few years back. The TClientDataSet had a somewhat plausible DataSize property, but the FireDAC memory table had no such thing.

 

A rather desperate approach would be saving the entire memory table into a stream and then determining the stream size which is rather silly and does not necessarily reflect how much the data actually takes up in your memory.

Share this post


Link to post
4 hours ago, Der schöne Günther said:

A rather desperate approach would be saving the entire memory table into a stream and then determining the stream size which is rather silly and does not necessarily reflect how much the data actually takes up in your memory.

The memory required for the stream doesn't have to be the same as for internal representation for the data. The only way to firure out is to query the memory manager before and after the operation.

Share this post


Link to post

I don't think comparing "memory usage before" and "memory usage after" in a release build is going to yield anything useful. There might be a lot of other things going on in separate threads.

  • Like 1

Share this post


Link to post
Guest

.

Edited by Guest

Share this post


Link to post
2 hours ago, Der schöne Günther said:

I don't think comparing "memory usage before" and "memory usage after" in a release build is going to yield anything useful.

I would agree with not much useful here. What is the threshold you are willing to allow for that memtable?

 

What level of precision are you looking for? Task Manager / Perfmon will get you close enough.

image.thumb.png.84d9a1f50c29e1f64169910bd9b2d700.png

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×