|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
| Taille memoire variable complexe |
| Débuté par Xavier BERNARD, 19 juil. 2019 12:04 - 2 réponses |
| |
| | | |
|
| |
Membre enregistré 59 messages |
|
| Posté le 19 juillet 2019 - 12:04 |
Bonjour,
Voici un bout de code de notre webservice test:
ST_EmployeeThings is Structure nThingID is int sName is string sCode is string sReference is string END
ST_ComplexData is Structure nEmployeeID is int nEmployeeCategory is int sEmployeeNameFirst is string sEmployeeNameLast is string sEmployeeNameEmail is string dEmployeeDOB is date nPictureID is int arrEmployeeThings is array of ST_EmployeeThings END
Depuis notre application client test, on appel notre webservice avec: response is OurWebservice.GetComplexDataResponse response = OurWebservice.GetComplexData()
Maintenant toutes les donnees sont dans notre "response" variable Il peut y en avoir beaucoup ou non. Nous voulons savoir la taille total de la variable en BYTES, et savoir si PCSOFT a une fonction pour cela pour ce type de variable. La taille memoire, variant avec la quantite d'information en retour. Nous pourrions parcourir tous les elements , controller leur taille etc...mais pas pratique du tout (Changement de type de structure etc.), influant aussi les temps de reponses. "Length(response)" retourne 0 ….
Donc y a t il une fonction qui permet de retourner la taille de la memoire occupee par cette variable en bytes. il y a une fonction pour les fichers mais on ne trouve pas pour ce type de variable.
Version en Anglais:
In our webservice we have: ST_EmployeeThings is Structure nThingID is int sName is string sCode is string sReference is string END
ST_ComplexData is Structure nEmployeeID is int nEmployeeCategory is int sEmployeeNameFirst is string sEmployeeNameLast is string sEmployeeNameEmail is string dEmployeeDOB is date nPictureID is int arrEmployeeThings is array of ST_EmployeeThings END And in the client application we call our webservice with: response is OurWebservice.GetComplexDataResponse response = OurWebservice.GetComplexData() Now the whole data is in our "response" variable - there might be a lot of it or not, we usually iterate through all elements. But now I want to know what is the size of the whole variable in memory in BYTES not amount of elements or something. I know I could iterate through all elements, count the variables, check all their lengths, multiply by their size in memory by default and get their size, add all results together and then... do it again for a different structure.... Impossible. That would take ages and every time there is a change it would require changing the whole code for that - especially impossible since I want to make this calculation on the client side. If they have terrible machine it would slow it down and we want to avoid that. The problem is that "Length(response)" is returning 0 and so on. I know there exist this functionality for files but it doesn't work for variables.
Voila si quelqu'un a une idee on est preneur, Merci et bon week-end Xavier |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 948 messages |
|
| Posté le 19 juillet 2019 - 12:21 |
bonjour avez-vous testé ce que renvois : Dimension(response) ?
-- L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai. Quand un utilisateur vous a aidé, n'oubliez pas de le remercier... |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 59 messages |
|
| Posté le 25 juillet 2019 - 12:53 |
Bonjour Philippe,
Merci pour l'info. On a teste Dimension mais cela ne marche pas pour nous car cela renvoit apparement la taille du pointeur de cette variable. On recoit 4 alors que la variable contenant la reponse du Webservice contient 381 elements donc une taille bien superieure.
J'ai aussi contacte PCSOFT qui a passe l'info au service technique (no comment)
Bonne journee et merci pour ton message
Xavier |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|